diff options
author | tv <tv@krebsco.de> | 2020-04-17 22:41:53 +0200 |
---|---|---|
committer | tv <tv@krebsco.de> | 2020-04-17 23:11:07 +0200 |
commit | 7dfc802b753f21afcb656b13d30d49bc548ac150 (patch) | |
tree | 664d84c3f6ec28b7affc26b509ddc608bd06939d /src/main.hs | |
parent | d6d51de7c9d54691b33a8ae9691fd0402259006a (diff) |
Reaktor.API: make configurable
Diffstat (limited to 'src/main.hs')
-rw-r--r-- | src/main.hs | 7 |
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 |