| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
System.Etc.Internal.Types
Documentation
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) #
getSelectedConfigSource :: MonadThrow m => [Text] -> config -> m ConfigSource #
Instances
| IConfig Config # | |
Defined in System.Etc.Internal.Config Methods getConfigValue :: (MonadThrow m, FromJSON result) => [Text] -> Config -> m result # getConfigValueWith :: MonadThrow m => (Value -> Parser result) -> [Text] -> Config -> m result # getAllConfigSources :: MonadThrow m => [Text] -> Config -> m (Set ConfigSource) # getSelectedConfigSource :: MonadThrow m => [Text] -> Config -> m ConfigSource # | |
Constructors
| Config | |
Fields | |
Instances
| Eq Config # | |
| Show Config # | |
| Semigroup Config # | |
| Monoid Config # | |
| IConfig Config # | |
Defined in System.Etc.Internal.Config Methods getConfigValue :: (MonadThrow m, FromJSON result) => [Text] -> Config -> m result # getConfigValueWith :: MonadThrow m => (Value -> Parser result) -> [Text] -> Config -> m result # getAllConfigSources :: MonadThrow m => [Text] -> Config -> m (Set ConfigSource) # getSelectedConfigSource :: MonadThrow m => [Text] -> Config -> m ConfigSource # | |
data ConfigValue #
Constructors
| ConfigValue | |
Fields
| |
| SubConfig | |
Fields
| |
Instances
| Eq ConfigValue # | |
Defined in System.Etc.Internal.Types | |
| Show ConfigValue # | |
Defined in System.Etc.Internal.Types Methods showsPrec :: Int -> ConfigValue -> ShowS # show :: ConfigValue -> String # showList :: [ConfigValue] -> ShowS # | |
| Semigroup ConfigValue # | |
Defined in System.Etc.Internal.Types Methods (<>) :: ConfigValue -> ConfigValue -> ConfigValue # sconcat :: NonEmpty ConfigValue -> ConfigValue # stimes :: Integral b => b -> ConfigValue -> ConfigValue # | |
| Monoid ConfigValue # | |
Defined in System.Etc.Internal.Types Methods mempty :: ConfigValue # mappend :: ConfigValue -> ConfigValue -> ConfigValue # mconcat :: [ConfigValue] -> ConfigValue # | |
data ConfigSource #
Constructors
| File | |
Fields
| |
| Env | |
| Cli | |
| Default | |
| None | |
Instances
| Eq ConfigSource # | |
Defined in System.Etc.Internal.Types | |
| Ord ConfigSource # | |
Defined in System.Etc.Internal.Types Methods compare :: ConfigSource -> ConfigSource -> Ordering # (<) :: ConfigSource -> ConfigSource -> Bool # (<=) :: ConfigSource -> ConfigSource -> Bool # (>) :: ConfigSource -> ConfigSource -> Bool # (>=) :: ConfigSource -> ConfigSource -> Bool # max :: ConfigSource -> ConfigSource -> ConfigSource # min :: ConfigSource -> ConfigSource -> ConfigSource # | |
| Show ConfigSource # | |
Defined in System.Etc.Internal.Types Methods showsPrec :: Int -> ConfigSource -> ShowS # show :: ConfigSource -> String # showList :: [ConfigSource] -> ShowS # | |
data FileSource #
Constructors
| FilePathSource | |
Fields
| |
| EnvVarFileSource | |
Fields
| |
Instances
| Eq FileSource # | |
Defined in System.Etc.Internal.Types | |
| Show FileSource # | |
Defined in System.Etc.Internal.Types Methods showsPrec :: Int -> FileSource -> ShowS # show :: FileSource -> String # showList :: [FileSource] -> ShowS # | |
Instances
| Functor Value # | |
| Applicative Value # | |
| Eq a => Eq (Value a) # | |
| Ord a => Ord (Value a) # | |
Defined in System.Etc.Internal.Types | |
| Show a => Show (Value a) # | |
| IsString a => IsString (Value a) # | |
Defined in System.Etc.Internal.Types Methods fromString :: String -> Value a # | |
| Generic (Value a) # | |
| type Rep (Value a) # | |
Defined in System.Etc.Internal.Types type Rep (Value a) = D1 (MetaData "Value" "System.Etc.Internal.Types" "etc-0.4.0.3-1VdOfTC1BjK5K2oA1bREav" False) (C1 (MetaCons "Plain" PrefixI True) (S1 (MetaSel (Just "fromValue") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 a)) :+: C1 (MetaCons "Sensitive" PrefixI True) (S1 (MetaSel (Just "fromValue") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 a))) | |
markAsSensitive :: Bool -> a -> Value a #
deepMerge :: ConfigValue -> ConfigValue -> ConfigValue #
isEmptySubConfig :: ConfigValue -> Bool #
writeInSubConfig :: Text -> ConfigValue -> ConfigValue -> ConfigValue #
filterMaybe :: (a -> Bool) -> Maybe a -> Maybe a #
data ConfigurationError #
Constructors
| InvalidConfiguration !(Maybe Text) !Text | |
| InvalidConfigKeyPath ![Text] | |
| ConfigurationFileNotFound !Text |