aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.hs')
-rw-r--r--src/main.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/main.hs b/src/main.hs
index 89966c2..51bc17c 100644
--- a/src/main.hs
+++ b/src/main.hs
@@ -23,7 +23,7 @@ main = do
v <- preview _Value <$> readFile configPath
- Reaktor.run (reaktorConfig v) $ \actions ->
+ Reaktor.run (reaktorConfig v) (apiConfig v) $ \actions ->
mapM id [
Reaktor.Plugins.Mention.new actions,
Reaktor.Plugins.Ping.new actions,
@@ -32,6 +32,11 @@ main = do
]
+apiConfig :: (FromJSON b) => Maybe Value -> Maybe b
+apiConfig = \case
+ Just v -> maybe Nothing parseOrDie (v ^? key "API")
+ Nothing -> Nothing
+
reaktorConfig :: (FromJSON b, Default b) => Maybe Value -> b
reaktorConfig = maybe def parseOrDie