diff options
Diffstat (limited to 'server/Main.hs')
-rw-r--r-- | server/Main.hs | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/server/Main.hs b/server/Main.hs index d9c548b..cb1a65b 100644 --- a/server/Main.hs +++ b/server/Main.hs @@ -51,8 +51,10 @@ import Servant.Client (ClientM, client, mkClientEnv, runClientM) type family PolyEndpoint method format payload where - PolyEndpoint Get format payload = Get format payload - PolyEndpoint Post format payload = Header "Auth" Text :> ReqBody format payload :> Post '[PlainText] Text + PolyEndpoint Get format payload = + Get format payload + PolyEndpoint Post format payload = + Header "Auth" Text :> ReqBody format payload :> Post '[PlainText] Text type MapServiceAPI method = @@ -111,20 +113,21 @@ main = do threadDelay (view interval config * 1000000) -- TODO: what about tls / https? - manager' <- newManager defaultManagerSettings - -- updater <- async $ forever $ do - -- done <- readMVar state - -- res <- runClientM - -- (postNewMaps (view token config) (MapService done)) - -- (mkClientEnv manager' (view exneuland config)) - -- print res - -- threadDelay (view interval config * 1000000) + whenJust (view exneuland config) $ \baseurl -> do + manager' <- newManager defaultManagerSettings + updater <- async $ forever $ do + done <- readMVar state + res <- runClientM + (postNewMaps (view token config) (MapService done)) + (mkClientEnv manager' baseurl) + print res + threadDelay (view interval config * 1000000) + link updater -- spawns threads for each job in the queue linter <- async $ void $ linterThread config queue state link linter link poker - -- link updater let warpsettings = setPort (view port config) |