diff options
| -rw-r--r-- | README.md | 7 | ||||
| -rw-r--r-- | src/main.hs | 7 |
2 files changed, 10 insertions, 4 deletions
@@ -14,6 +14,13 @@ "pass": "somepass" } + or, if the password should be read from a separate file containing a JSON value, then: + + { + "nick": "somenick", + "pass": { "$ref": "path/to/pass.json" } + } + then enter the Nix shell for development: cabal2nix . > default.nix && nix-shell -I stockholm=~/stockholm diff --git a/src/main.hs b/src/main.hs index b57d161..757f732 100644 --- a/src/main.hs +++ b/src/main.hs @@ -3,11 +3,9 @@ module Main (main) where import Control.Lens -import Data.Aeson -import Data.Aeson (Value) import Data.Aeson.Lens +import Data.Aeson.Reference (resolveReference) import Data.Aeson.Types -import Data.Text (Text) import Prelude.Extended import qualified Reaktor import qualified Reaktor.Plugins.Mention @@ -16,13 +14,14 @@ import qualified Reaktor.Plugins.Register import qualified Reaktor.Plugins.SASL import qualified Reaktor.Plugins.System import qualified System.Environment +import qualified Data.Text as Text main :: IO () main = do [configPath] <- System.Environment.getArgs - v <- preview _Value <$> readFile configPath + v <- either error (preview _Value) <$> resolveReference "." (Text.pack configPath) Reaktor.run (reaktorConfig v) (apiConfig v) $ \actions -> mapM id [ |
