| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
System.Etc.Internal.Types
Documentation
markAsSensitive :: Bool -> a -> Value a Source #
data FileSource Source #
Constructors
| FilePathSource | |
Fields
| |
| EnvVarFileSource | |
Fields
| |
Instances
data ConfigSource Source #
Constructors
| File | |
Fields
| |
| Env | |
| Cli | |
| Default | |
| None | |
Instances
data ConfigValue Source #
Constructors
| ConfigValue | |
Fields
| |
| SubConfig | |
Fields
| |
Instances
deepMerge :: ConfigValue -> ConfigValue -> ConfigValue Source #
Constructors
| Config | |
Fields | |
isEmptySubConfig :: ConfigValue -> Bool Source #
writeInSubConfig :: Text -> ConfigValue -> ConfigValue -> ConfigValue Source #
class IConfig config where Source #
Minimal complete definition
getConfigValue, getConfigValueWith, getAllConfigSources, getSelectedConfigSource
Methods
Arguments
| :: (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 TextJust "root">>>getConfigValue ["db", "password"] config :: Maybe TextNothing
Arguments
| :: 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"] configJust (DbConnectInfo {...})
getAllConfigSources :: MonadThrow m => [Text] -> config -> m (Set ConfigSource) Source #
getSelectedConfigSource :: MonadThrow m => [Text] -> config -> m ConfigSource Source #