diff options
author | Roman Smrž <roman.smrz@seznam.cz> | 2020-12-28 16:08:23 +0100 |
---|---|---|
committer | Roman Smrž <roman.smrz@seznam.cz> | 2020-12-28 16:13:36 +0100 |
commit | b2d1f57098ae12a22fe7511eb765c39158600d17 (patch) | |
tree | f3dd53f43db113b2fb76676cb0d1ed338c94bfb4 /src/Main.hs | |
parent | 36b9a1ddbddf1477c61809d340cd0b86360a7a83 (diff) |
Ephemeral port option with disabled local discovery
Diffstat (limited to 'src/Main.hs')
-rw-r--r-- | src/Main.hs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/Main.hs b/src/Main.hs index a847bd1..8da74b1 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -85,10 +85,11 @@ main = do BC.putStrLn . showRefDigest . refDigest . storedRef . idData =<< interactiveIdentityUpdate idt | otherwise -> error "invalid identity" - [bhost] -> interactiveLoop st bhost - _ -> error "Expecting broadcast address" + [bhost] -> interactiveLoop st (Just bhost) + [] -> interactiveLoop st Nothing + _ -> error "Unrecognized options" -interactiveLoop :: Storage -> String -> IO () +interactiveLoop :: Storage -> Maybe String -> IO () interactiveLoop st bhost = runInputT defaultSettings $ do erebosHead <- liftIO $ loadLocalStateHead st outputStrLn $ T.unpack $ displayIdentity $ headLocalIdentity erebosHead @@ -99,7 +100,10 @@ interactiveLoop st bhost = runInputT defaultSettings $ do let extPrintLn str = extPrint $ case reverse str of ('\n':_) -> str _ -> str ++ "\n"; server <- liftIO $ do - startServer erebosHead extPrintLn bhost + let sopt = defaultServerOptions + { serverLocalDiscovery = bhost + } + startServer sopt erebosHead extPrintLn [ SomeService @AttachService Proxy , SomeService @SyncService Proxy , SomeService @ContactService Proxy |