diff options
author | Joey Hess <joeyh@joeyh.name> | 2016-08-29 19:11:51 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2016-08-29 19:11:51 -0400 |
commit | aead2b77331482ca3af2ea386de00e41c50f7c12 (patch) | |
tree | 2dd818c3371d045e123917a4eb82c0baeb4cf563 /HTTP | |
parent | 7ad3536737f30bbd328a4d37f78a72f9600fb4b8 (diff) | |
download | keysafe-aead2b77331482ca3af2ea386de00e41c50f7c12.tar.gz |
make server default to only listening to localhost
This way, the tor hidden service using it will be the only way it's
exposed.
Diffstat (limited to 'HTTP')
-rw-r--r-- | HTTP/Server.hs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/HTTP/Server.hs b/HTTP/Server.hs index f599c31..fa2e8da 100644 --- a/HTTP/Server.hs +++ b/HTTP/Server.hs @@ -19,6 +19,7 @@ import Network.Wai.Handler.Warp import Control.Monad.IO.Class import Control.Concurrent import Control.Concurrent.STM +import Data.String import qualified Data.ByteString as B data ServerState = ServerState @@ -29,11 +30,14 @@ newServerState :: IO ServerState newServerState = ServerState <$> newEmptyTMVarIO -runServer :: Port -> IO () -runServer port = do +runServer :: String -> Port -> IO () +runServer bindaddress port = do st <- newServerState _ <- forkIO $ obscurerThread st - run port (app st) + runSettings settings (app st) + where + settings = setHost host $ setPort port $ defaultSettings + host = fromString bindaddress serverStorage :: Storage serverStorage = localStorage "server" |