Safe Haskell | None |
---|---|
Language | Haskell2010 |
Documentation
boolToValue :: Bool -> a -> Value a Source #
data ConfigValue Source #
ConfigValue | |
| |
SubConfig | |
|
deepMerge :: ConfigValue -> ConfigValue -> ConfigValue Source #
isEmptySubConfig :: ConfigValue -> Bool Source #
writeInSubConfig :: Text -> ConfigValue -> ConfigValue -> ConfigValue Source #
class IConfig config where Source #
:: (MonadThrow m, FromJSON result) | |
=> [Text] | Key to fetch from config map |
-> config | Config record |
-> m result |
Fetches a configuration value from a given key, if key
is not found, you may pick the failure mode via the MonadThrow
interface.
example:
>>>
getConfigValue ["db", "user"] config :: Maybe Text
Just "root">>>
getConfigValue ["db", "password"] config :: Maybe Text
Nothing
:: MonadThrow m | |
=> (Value -> Parser result) | JSON Parser function |
-> [Text] | Key to fetch from config map |
-> config | Config record |
-> m result |
Fetches a configuration value from a given key, normally this key will
point to a sub-config JSON object, which is then passed to the given JSON
parser function. If key is not found, you may pick the failure mode via the
MonadThrow
interface.
example:
>>>
import qualified Data.Aeson as JSON
>>>
import qualified Data.Aeson.Types as JSON (Parser)
>>>
connectInfoParser :: JSON.Value -> JSON.Parser DbConnectInfo
>>>
getConfigValueWith connectInfoParser ["db"] config
Just (DbConnectInfo {...})
getAllConfigSources :: MonadThrow m => [Text] -> config -> m (Set ConfigSource) Source #
getSelectedConfigSource :: MonadThrow m => [Text] -> config -> m ConfigSource Source #