diff options
Diffstat (limited to 'hsm-core/Hsm/Core/Env.hs')
-rw-r--r-- | hsm-core/Hsm/Core/Env.hs | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/hsm-core/Hsm/Core/Env.hs b/hsm-core/Hsm/Core/Env.hs index 4e7986f..8ef7464 100644 --- a/hsm-core/Hsm/Core/Env.hs +++ b/hsm-core/Hsm/Core/Env.hs @@ -3,9 +3,9 @@ module Hsm.Core.Env , deriveFromYaml ) where -import Data.Aeson (FromJSON, Result(Error, Success), Value, fromJSON) +import Data.Aeson (FromJSON, Result(Error, Success), fromJSON) import Data.Aeson.Key (fromText) -import Data.Aeson.KeyMap (KeyMap, (!?)) +import Data.Aeson.KeyMap ((!?)) import Data.Aeson.TH (defaultOptions, deriveFromJSON, rejectUnknownFields) import Data.Maybe (fromMaybe) import Data.Text (Text, unpack) @@ -15,13 +15,10 @@ import Language.Haskell.TH (Dec, Name, Q) environment :: FromJSON env => Text -> Text -> IO env environment name = fmap (check . fromJSON . load) . decodeFileThrow . unpack where - load :: KeyMap Value -> Value load keymap = fromMaybe (error $ "Service configuration for " <> unpack name <> " not found)") $ keymap !? fromText name - -- - check :: Result env -> env check (Success env) = env check (Error str) = error str |