Skip to content

Commit

Permalink
server password taken from command line
Browse files Browse the repository at this point in the history
  • Loading branch information
d0kt0r0 committed Jul 27, 2017
1 parent 88bb4bf commit 6337b9c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion EstuaryServer.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import Control.Monad
import Control.Concurrent.MVar
import Control.Exception (try)
import Text.JSON
import System.Environment (getArgs)

import Estuary.Utility
import Estuary.Types.Definition
Expand All @@ -27,8 +28,12 @@ import Estuary.Types.Server


main = do
args <- getArgs
let pwd = if (length args >= 1) then args!!0 else ""
putStrLn "Estuary collaborative editing server (listening on port 8001)"
server <- newMVar newServer
putStrLn $ "password: " ++ pwd
let ourServer = newServer { password = pwd }
server <- newMVar ourServer
WS.runServer "0.0.0.0" 8001 $ connectionHandler server

connectionHandler :: MVar Server -> WS.PendingConnection -> IO ()
Expand Down

0 comments on commit 6337b9c

Please sign in to comment.