diff options
author | metamuffin <metamuffin@disroot.org> | 2023-10-15 11:09:15 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2023-10-15 11:09:15 +0200 |
commit | c2f56de490704e3fd6e5d2633e03dab20cce33ff (patch) | |
tree | caa6873ccb91388bb50e9bbbd189cfa642072830 /src/Main.hs | |
parent | a07a29ef8f22a96b12f9777fc34c2554e6c201ab (diff) | |
download | fastbangs-c2f56de490704e3fd6e5d2633e03dab20cce33ff.tar fastbangs-c2f56de490704e3fd6e5d2633e03dab20cce33ff.tar.bz2 fastbangs-c2f56de490704e3fd6e5d2633e03dab20cce33ff.tar.zst |
customizable database path
Diffstat (limited to 'src/Main.hs')
-rw-r--r-- | src/Main.hs | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/Main.hs b/src/Main.hs index d69ced6..095cdbe 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -150,20 +150,21 @@ sendPendingBangs cfg pool = do "Please do something about it.\n" main :: IO () -main = runStdoutLoggingT $ withSqlitePool "banger.db" 2 $ \pool -> do - runResourceT $ flip runSqlPool pool $ runMigration migrateAll +main = do + cfg <- getConfig + runStdoutLoggingT $ withSqlitePool (confDbPath cfg) 2 $ \pool -> do + runResourceT $ flip runSqlPool pool $ runMigration migrateAll - bs <- liftIO initBangState - cfg <- liftIO getConfig - $(logInfo) $ "Using config: " <> T.pack (show cfg) + bs <- liftIO initBangState + $(logInfo) $ "Using config: " <> T.pack (show cfg) - sendPbIO <- toIO $ sendPendingBangs cfg pool - notifyPb <- liftIO $ makeRunner sendPbIO 600000000 {- 10 min -} + sendPbIO <- toIO $ sendPendingBangs cfg pool + notifyPb <- liftIO $ makeRunner sendPbIO 600000000 {- 10 min -} - sApp <- liftIO $ toWaiApp $ Search bs pool cfg notifyPb -- includes middlewares + sApp <- liftIO $ toWaiApp $ Search bs pool cfg notifyPb -- includes middlewares - let settings = defaultSettings - & setHost (confHost cfg) - & setPort (confPort cfg) + let settings = defaultSettings + & setHost (confHost cfg) + & setPort (confPort cfg) - liftIO $ runSettings settings sApp + liftIO $ runSettings settings sApp |