-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Declarative configuration spec for Haskell projects -- -- etc gathers configuration values from multiple sources (cli -- options, OS environment variables, files) using a declarative spec -- file that defines where these values are to be found and located in a -- configuration map. @package etc @version 0.4.1.0 module System.Etc.Internal.Spec.Types data CliOptValueType StringOpt :: CliOptValueType NumberOpt :: CliOptValueType SwitchOpt :: CliOptValueType data CliArgValueType StringArg :: CliArgValueType NumberArg :: CliArgValueType data CliOptMetadata CliOptMetadata :: !(Maybe Text) -> !(Maybe Text) -> !(Maybe Text) -> !(Maybe Text) -> !Bool -> CliOptMetadata [optLong] :: CliOptMetadata -> !(Maybe Text) [optShort] :: CliOptMetadata -> !(Maybe Text) [optMetavar] :: CliOptMetadata -> !(Maybe Text) [optHelp] :: CliOptMetadata -> !(Maybe Text) [optRequired] :: CliOptMetadata -> !Bool data CliArgMetadata CliArgMetadata :: !(Maybe Text) -> !(Maybe Text) -> !Bool -> CliArgMetadata [argMetavar] :: CliArgMetadata -> !(Maybe Text) [argHelp] :: CliArgMetadata -> !(Maybe Text) [argRequired] :: CliArgMetadata -> !Bool data CliSwitchMetadata CliSwitchMetadata :: !Text -> !(Maybe Text) -> CliSwitchMetadata [switchLong] :: CliSwitchMetadata -> !Text [switchHelp] :: CliSwitchMetadata -> !(Maybe Text) data CliEntryMetadata Opt :: CliOptMetadata -> CliEntryMetadata Arg :: CliArgMetadata -> CliEntryMetadata Switch :: CliSwitchMetadata -> CliEntryMetadata data CliEntrySpec cmd CmdEntry :: !(Vector cmd) -> !CliEntryMetadata -> CliEntrySpec cmd [cliEntryCmdValue] :: CliEntrySpec cmd -> !(Vector cmd) [cliEntryMetadata] :: CliEntrySpec cmd -> !CliEntryMetadata PlainEntry :: !CliEntryMetadata -> CliEntrySpec cmd [cliEntryMetadata] :: CliEntrySpec cmd -> !CliEntryMetadata data CliCmdSpec CliCmdSpec :: !Text -> !Text -> CliCmdSpec [cliCmdDesc] :: CliCmdSpec -> !Text [cliCmdHeader] :: CliCmdSpec -> !Text data ConfigSources cmd ConfigSources :: !(Maybe Text) -> !(Maybe (CliEntrySpec cmd)) -> ConfigSources cmd [envVar] :: ConfigSources cmd -> !(Maybe Text) [cliEntry] :: ConfigSources cmd -> !(Maybe (CliEntrySpec cmd)) data SingleConfigValueType CVTString :: SingleConfigValueType CVTNumber :: SingleConfigValueType CVTBool :: SingleConfigValueType CVTObject :: SingleConfigValueType data ConfigValueType CVTSingle :: !SingleConfigValueType -> ConfigValueType CVTArray :: !SingleConfigValueType -> ConfigValueType data ConfigValue cmd ConfigValue :: !(Maybe Value) -> !ConfigValueType -> !Bool -> !(ConfigSources cmd) -> ConfigValue cmd [defaultValue] :: ConfigValue cmd -> !(Maybe Value) [configValueType] :: ConfigValue cmd -> !ConfigValueType [isSensitive] :: ConfigValue cmd -> !Bool [configSources] :: ConfigValue cmd -> !(ConfigSources cmd) SubConfig :: !(HashMap Text (ConfigValue cmd)) -> ConfigValue cmd [subConfig] :: ConfigValue cmd -> !(HashMap Text (ConfigValue cmd)) data CliProgramSpec CliProgramSpec :: !Text -> !Text -> !(Maybe (HashMap Text CliCmdSpec)) -> CliProgramSpec [cliProgramDesc] :: CliProgramSpec -> !Text [cliProgramHeader] :: CliProgramSpec -> !Text [cliCommands] :: CliProgramSpec -> !(Maybe (HashMap Text CliCmdSpec)) data FilesSpec FilePathsSpec :: ![Text] -> FilesSpec FilesSpec :: !(Maybe Text) -> ![Text] -> FilesSpec [fileLocationEnvVar] :: FilesSpec -> !(Maybe Text) [fileLocationPaths] :: FilesSpec -> ![Text] data ConfigSpec cmd ConfigSpec :: !(Maybe FilesSpec) -> !(Maybe CliProgramSpec) -> !(HashMap Text (ConfigValue cmd)) -> ConfigSpec cmd [specConfigFilepaths] :: ConfigSpec cmd -> !(Maybe FilesSpec) [specCliProgramSpec] :: ConfigSpec cmd -> !(Maybe CliProgramSpec) [specConfigValues] :: ConfigSpec cmd -> !(HashMap Text (ConfigValue cmd)) instance GHC.Classes.Eq cmd => GHC.Classes.Eq (System.Etc.Internal.Spec.Types.ConfigSpec cmd) instance GHC.Show.Show cmd => GHC.Show.Show (System.Etc.Internal.Spec.Types.ConfigSpec cmd) instance GHC.Generics.Generic (System.Etc.Internal.Spec.Types.ConfigSpec cmd) instance GHC.Classes.Eq System.Etc.Internal.Spec.Types.FilesSpec instance GHC.Show.Show System.Etc.Internal.Spec.Types.FilesSpec instance GHC.Generics.Generic System.Etc.Internal.Spec.Types.FilesSpec instance GHC.Classes.Eq System.Etc.Internal.Spec.Types.CliProgramSpec instance GHC.Show.Show System.Etc.Internal.Spec.Types.CliProgramSpec instance GHC.Generics.Generic System.Etc.Internal.Spec.Types.CliProgramSpec instance GHC.Classes.Eq cmd => GHC.Classes.Eq (System.Etc.Internal.Spec.Types.ConfigValue cmd) instance GHC.Show.Show cmd => GHC.Show.Show (System.Etc.Internal.Spec.Types.ConfigValue cmd) instance GHC.Generics.Generic (System.Etc.Internal.Spec.Types.ConfigValue cmd) instance Language.Haskell.TH.Syntax.Lift System.Etc.Internal.Spec.Types.ConfigValueType instance GHC.Classes.Eq System.Etc.Internal.Spec.Types.ConfigValueType instance GHC.Read.Read System.Etc.Internal.Spec.Types.ConfigValueType instance GHC.Show.Show System.Etc.Internal.Spec.Types.ConfigValueType instance GHC.Generics.Generic System.Etc.Internal.Spec.Types.ConfigValueType instance Language.Haskell.TH.Syntax.Lift System.Etc.Internal.Spec.Types.SingleConfigValueType instance GHC.Classes.Eq System.Etc.Internal.Spec.Types.SingleConfigValueType instance GHC.Read.Read System.Etc.Internal.Spec.Types.SingleConfigValueType instance GHC.Show.Show System.Etc.Internal.Spec.Types.SingleConfigValueType instance GHC.Generics.Generic System.Etc.Internal.Spec.Types.SingleConfigValueType instance GHC.Classes.Eq cmd => GHC.Classes.Eq (System.Etc.Internal.Spec.Types.ConfigSources cmd) instance GHC.Show.Show cmd => GHC.Show.Show (System.Etc.Internal.Spec.Types.ConfigSources cmd) instance GHC.Generics.Generic (System.Etc.Internal.Spec.Types.ConfigSources cmd) instance GHC.Classes.Eq System.Etc.Internal.Spec.Types.CliCmdSpec instance GHC.Show.Show System.Etc.Internal.Spec.Types.CliCmdSpec instance GHC.Generics.Generic System.Etc.Internal.Spec.Types.CliCmdSpec instance GHC.Classes.Eq cmd => GHC.Classes.Eq (System.Etc.Internal.Spec.Types.CliEntrySpec cmd) instance GHC.Show.Show cmd => GHC.Show.Show (System.Etc.Internal.Spec.Types.CliEntrySpec cmd) instance GHC.Generics.Generic (System.Etc.Internal.Spec.Types.CliEntrySpec cmd) instance GHC.Classes.Eq System.Etc.Internal.Spec.Types.CliEntryMetadata instance GHC.Show.Show System.Etc.Internal.Spec.Types.CliEntryMetadata instance GHC.Generics.Generic System.Etc.Internal.Spec.Types.CliEntryMetadata instance GHC.Classes.Eq System.Etc.Internal.Spec.Types.CliSwitchMetadata instance GHC.Show.Show System.Etc.Internal.Spec.Types.CliSwitchMetadata instance GHC.Generics.Generic System.Etc.Internal.Spec.Types.CliSwitchMetadata instance GHC.Classes.Eq System.Etc.Internal.Spec.Types.CliArgMetadata instance GHC.Show.Show System.Etc.Internal.Spec.Types.CliArgMetadata instance GHC.Generics.Generic System.Etc.Internal.Spec.Types.CliArgMetadata instance GHC.Classes.Eq System.Etc.Internal.Spec.Types.CliOptMetadata instance GHC.Show.Show System.Etc.Internal.Spec.Types.CliOptMetadata instance GHC.Generics.Generic System.Etc.Internal.Spec.Types.CliOptMetadata instance Language.Haskell.TH.Syntax.Lift System.Etc.Internal.Spec.Types.CliArgValueType instance GHC.Classes.Eq System.Etc.Internal.Spec.Types.CliArgValueType instance GHC.Show.Show System.Etc.Internal.Spec.Types.CliArgValueType instance GHC.Generics.Generic System.Etc.Internal.Spec.Types.CliArgValueType instance Language.Haskell.TH.Syntax.Lift System.Etc.Internal.Spec.Types.CliOptValueType instance GHC.Classes.Eq System.Etc.Internal.Spec.Types.CliOptValueType instance GHC.Show.Show System.Etc.Internal.Spec.Types.CliOptValueType instance GHC.Generics.Generic System.Etc.Internal.Spec.Types.CliOptValueType instance Language.Haskell.TH.Syntax.Lift cmd => Language.Haskell.TH.Syntax.Lift (System.Etc.Internal.Spec.Types.ConfigSpec cmd) instance Language.Haskell.TH.Syntax.Lift System.Etc.Internal.Spec.Types.FilesSpec instance Language.Haskell.TH.Syntax.Lift System.Etc.Internal.Spec.Types.CliProgramSpec instance Language.Haskell.TH.Syntax.Lift cmd => Language.Haskell.TH.Syntax.Lift (System.Etc.Internal.Spec.Types.ConfigValue cmd) instance RIO.Prelude.Display.Display System.Etc.Internal.Spec.Types.ConfigValueType instance RIO.Prelude.Display.Display System.Etc.Internal.Spec.Types.SingleConfigValueType instance Language.Haskell.TH.Syntax.Lift cmd => Language.Haskell.TH.Syntax.Lift (System.Etc.Internal.Spec.Types.ConfigSources cmd) instance Language.Haskell.TH.Syntax.Lift System.Etc.Internal.Spec.Types.CliCmdSpec instance Language.Haskell.TH.Syntax.Lift cmd => Language.Haskell.TH.Syntax.Lift (System.Etc.Internal.Spec.Types.CliEntrySpec cmd) instance Language.Haskell.TH.Syntax.Lift System.Etc.Internal.Spec.Types.CliEntryMetadata instance Language.Haskell.TH.Syntax.Lift System.Etc.Internal.Spec.Types.CliSwitchMetadata instance Language.Haskell.TH.Syntax.Lift System.Etc.Internal.Spec.Types.CliArgMetadata instance Language.Haskell.TH.Syntax.Lift System.Etc.Internal.Spec.Types.CliOptMetadata module System.Etc.Internal.Errors -- | Thrown when calling the getConfig or getConfigWith -- functions on a key that does not exist in the configuration spec newtype InvalidConfigKeyPath InvalidConfigKeyPath :: [Text] -> InvalidConfigKeyPath -- | Input Keys [$sel:inputKeys:InvalidConfigKeyPath] :: InvalidConfigKeyPath -> [Text] -- | Thrown when there is a type mismatch in a JSON parser given via -- getConfigWith data ConfigValueParserFailed ConfigValueParserFailed :: ![Text] -> !Text -> ConfigValueParserFailed -- | Input Keys [$sel:inputKeys:ConfigValueParserFailed] :: ConfigValueParserFailed -> ![Text] -- | Parser Error Message [$sel:parserErrorMessage:ConfigValueParserFailed] :: ConfigValueParserFailed -> !Text -- | Thrown when the resolveFile function finds a key on a -- configuration file that is not specified in the given configuration -- spec data UnknownConfigKeyFound UnknownConfigKeyFound :: ![Text] -> !Text -> ![Text] -> UnknownConfigKeyFound -- | Parent Keys [$sel:parentKeys:UnknownConfigKeyFound] :: UnknownConfigKeyFound -> ![Text] -- | Key Name [$sel:keyName:UnknownConfigKeyFound] :: UnknownConfigKeyFound -> !Text -- | Sibling Keys (other keys in the same level) [$sel:siblingKeys:UnknownConfigKeyFound] :: UnknownConfigKeyFound -> ![Text] -- | Thrown when there is a type mismatch on a configuration entry, -- specifically, when there is a raw value instead of a sub-config in a -- configuration file data SubConfigEntryExpected SubConfigEntryExpected :: !Text -> !Value -> SubConfigEntryExpected -- | Key Name [$sel:keyName:SubConfigEntryExpected] :: SubConfigEntryExpected -> !Text -- | Config Value [$sel:configValue:SubConfigEntryExpected] :: SubConfigEntryExpected -> !Value -- | This error is thrown when a type mismatch is found in a raw value when -- calling resolveFile data ConfigValueTypeMismatchFound ConfigValueTypeMismatchFound :: !Text -> !Value -> !ConfigValueType -> ConfigValueTypeMismatchFound -- | Key Name [$sel:keyName:ConfigValueTypeMismatchFound] :: ConfigValueTypeMismatchFound -> !Text -- | Config Value [$sel:configValueEntry:ConfigValueTypeMismatchFound] :: ConfigValueTypeMismatchFound -> !Value -- | Config Value Type [$sel:configValueEntryType:ConfigValueTypeMismatchFound] :: ConfigValueTypeMismatchFound -> !ConfigValueType -- | Thrown when a specified configuration file is not found in the system newtype ConfigurationFileNotFound ConfigurationFileNotFound :: Text -> ConfigurationFileNotFound -- | Config FilePath [$sel:configFilepath:ConfigurationFileNotFound] :: ConfigurationFileNotFound -> Text -- | Thrown when an input configuration file contains an unsupported file -- extension newtype UnsupportedFileExtensionGiven UnsupportedFileExtensionGiven :: Text -> UnsupportedFileExtensionGiven -- | Config FilePath [$sel:configFilepath:UnsupportedFileExtensionGiven] :: UnsupportedFileExtensionGiven -> Text -- | Thrown when an input configuration file contains invalid syntax data ConfigInvalidSyntaxFound ConfigInvalidSyntaxFound :: !Text -> !Text -> ConfigInvalidSyntaxFound -- | Config FilePath [$sel:configFilepath:ConfigInvalidSyntaxFound] :: ConfigInvalidSyntaxFound -> !Text -- | Parser Error Message [$sel:parserErrorMessage:ConfigInvalidSyntaxFound] :: ConfigInvalidSyntaxFound -> !Text -- | Thrown when an configuration spec file contains invalid syntax data SpecInvalidSyntaxFound SpecInvalidSyntaxFound :: !(Maybe Text) -> !Text -> SpecInvalidSyntaxFound -- | Spec FilePath [$sel:specFilepath:SpecInvalidSyntaxFound] :: SpecInvalidSyntaxFound -> !(Maybe Text) -- | Parser Error Message [$sel:parseErrorMessage:SpecInvalidSyntaxFound] :: SpecInvalidSyntaxFound -> !Text instance GHC.Classes.Eq System.Etc.Internal.Errors.SpecInvalidSyntaxFound instance GHC.Read.Read System.Etc.Internal.Errors.SpecInvalidSyntaxFound instance GHC.Show.Show System.Etc.Internal.Errors.SpecInvalidSyntaxFound instance GHC.Generics.Generic System.Etc.Internal.Errors.SpecInvalidSyntaxFound instance GHC.Classes.Eq System.Etc.Internal.Errors.ConfigInvalidSyntaxFound instance GHC.Read.Read System.Etc.Internal.Errors.ConfigInvalidSyntaxFound instance GHC.Show.Show System.Etc.Internal.Errors.ConfigInvalidSyntaxFound instance GHC.Generics.Generic System.Etc.Internal.Errors.ConfigInvalidSyntaxFound instance GHC.Classes.Eq System.Etc.Internal.Errors.UnsupportedFileExtensionGiven instance GHC.Read.Read System.Etc.Internal.Errors.UnsupportedFileExtensionGiven instance GHC.Show.Show System.Etc.Internal.Errors.UnsupportedFileExtensionGiven instance GHC.Generics.Generic System.Etc.Internal.Errors.UnsupportedFileExtensionGiven instance GHC.Classes.Eq System.Etc.Internal.Errors.ConfigurationFileNotFound instance GHC.Read.Read System.Etc.Internal.Errors.ConfigurationFileNotFound instance GHC.Show.Show System.Etc.Internal.Errors.ConfigurationFileNotFound instance GHC.Generics.Generic System.Etc.Internal.Errors.ConfigurationFileNotFound instance GHC.Classes.Eq System.Etc.Internal.Errors.ConfigValueTypeMismatchFound instance GHC.Read.Read System.Etc.Internal.Errors.ConfigValueTypeMismatchFound instance GHC.Show.Show System.Etc.Internal.Errors.ConfigValueTypeMismatchFound instance GHC.Generics.Generic System.Etc.Internal.Errors.ConfigValueTypeMismatchFound instance GHC.Classes.Eq System.Etc.Internal.Errors.SubConfigEntryExpected instance GHC.Read.Read System.Etc.Internal.Errors.SubConfigEntryExpected instance GHC.Show.Show System.Etc.Internal.Errors.SubConfigEntryExpected instance GHC.Generics.Generic System.Etc.Internal.Errors.SubConfigEntryExpected instance GHC.Classes.Eq System.Etc.Internal.Errors.UnknownConfigKeyFound instance GHC.Read.Read System.Etc.Internal.Errors.UnknownConfigKeyFound instance GHC.Show.Show System.Etc.Internal.Errors.UnknownConfigKeyFound instance GHC.Generics.Generic System.Etc.Internal.Errors.UnknownConfigKeyFound instance GHC.Classes.Eq System.Etc.Internal.Errors.ConfigValueParserFailed instance GHC.Read.Read System.Etc.Internal.Errors.ConfigValueParserFailed instance GHC.Show.Show System.Etc.Internal.Errors.ConfigValueParserFailed instance GHC.Generics.Generic System.Etc.Internal.Errors.ConfigValueParserFailed instance GHC.Classes.Eq System.Etc.Internal.Errors.InvalidConfigKeyPath instance GHC.Read.Read System.Etc.Internal.Errors.InvalidConfigKeyPath instance GHC.Show.Show System.Etc.Internal.Errors.InvalidConfigKeyPath instance GHC.Generics.Generic System.Etc.Internal.Errors.InvalidConfigKeyPath instance GHC.Exception.Exception System.Etc.Internal.Errors.SpecInvalidSyntaxFound instance GHC.Exception.Exception System.Etc.Internal.Errors.ConfigInvalidSyntaxFound instance GHC.Exception.Exception System.Etc.Internal.Errors.UnsupportedFileExtensionGiven instance GHC.Exception.Exception System.Etc.Internal.Errors.ConfigurationFileNotFound instance GHC.Exception.Exception System.Etc.Internal.Errors.ConfigValueTypeMismatchFound instance GHC.Exception.Exception System.Etc.Internal.Errors.SubConfigEntryExpected instance GHC.Exception.Exception System.Etc.Internal.Errors.UnknownConfigKeyFound instance GHC.Exception.Exception System.Etc.Internal.Errors.ConfigValueParserFailed instance GHC.Exception.Exception System.Etc.Internal.Errors.InvalidConfigKeyPath module System.Etc.Internal.Spec.Parser cliArgTypeParser :: Object -> Parser CliArgValueType cliArgParser :: Object -> Parser CliEntryMetadata cliOptParser :: Object -> Parser CliEntryMetadata cliSwitchParser :: Object -> Parser CliEntryMetadata cliArgKeys :: [Text] cliOptKeys :: [Text] inferErrorMsg :: String parseBytesToConfigValueJSON :: ConfigValueType -> Text -> Maybe Value jsonToConfigValueType :: Value -> Either String ConfigValueType coerceConfigValueType :: Text -> Value -> ConfigValueType -> Maybe Value matchesConfigValueType :: Value -> ConfigValueType -> Bool assertMatchingConfigValueType :: Value -> ConfigValueType -> Either SomeException () getConfigValueType :: Maybe Value -> Maybe ConfigValueType -> Parser ConfigValueType parseFiles :: Value -> Parser FilesSpec parseFilePaths :: Value -> Parser FilesSpec parseFileSpec :: Value -> Parser (Maybe FilesSpec) instance Data.Aeson.Types.FromJSON.FromJSON System.Etc.Internal.Spec.Types.CliCmdSpec instance Data.Aeson.Types.FromJSON.FromJSON System.Etc.Internal.Spec.Types.CliProgramSpec instance Data.Aeson.Types.FromJSON.FromJSON cmd => Data.Aeson.Types.FromJSON.FromJSON (System.Etc.Internal.Spec.Types.CliEntrySpec cmd) instance Data.Aeson.Types.FromJSON.FromJSON System.Etc.Internal.Spec.Types.ConfigValueType instance Data.Aeson.Types.FromJSON.FromJSON cmd => Data.Aeson.Types.FromJSON.FromJSON (System.Etc.Internal.Spec.Types.ConfigValue cmd) instance Data.Aeson.Types.FromJSON.FromJSON cmd => Data.Aeson.Types.FromJSON.FromJSON (System.Etc.Internal.Spec.Types.ConfigSpec cmd) module System.Etc.Internal.Spec.JSON parseConfigSpec_ :: (MonadThrow m, FromJSON cmd) => Maybe Text -> Text -> m (ConfigSpec cmd) parseConfigSpec :: (MonadThrow m, FromJSON cmd) => Text -> m (ConfigSpec cmd) readConfigSpec :: FromJSON cmd => Text -> IO (ConfigSpec cmd) module System.Etc.Internal.Spec.JSON.TH readConfigSpecTH_ :: (Lift k) => Proxy k -> (Text -> IO (ConfigSpec k)) -> Text -> ExpQ readConfigSpecTH :: (Lift k, FromJSON k) => Proxy k -> Text -> ExpQ module System.Etc.Internal.Types class IConfig config -- | 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
--   
getConfigValue :: (IConfig config, MonadThrow m, FromJSON result) => [Text] -> config -> 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 {...})
--   
getConfigValueWith :: (IConfig config, (MonadThrow m)) => (Value -> Parser result) -> [Text] -> config -> m result getAllConfigSources :: (IConfig config, (MonadThrow m)) => [Text] -> config -> m (Set ConfigSource) getSelectedConfigSource :: (IConfig config, (MonadThrow m)) => [Text] -> config -> m ConfigSource newtype Config Config :: ConfigValue -> Config [fromConfig] :: Config -> ConfigValue data ConfigValue ConfigValue :: !(Set ConfigSource) -> ConfigValue [configSource] :: ConfigValue -> !(Set ConfigSource) SubConfig :: !(HashMap Text ConfigValue) -> ConfigValue [configMap] :: ConfigValue -> !(HashMap Text ConfigValue) data ConfigSource File :: !Int -> !FileSource -> !(Value Value) -> ConfigSource [configIndex] :: ConfigSource -> !Int [filepath] :: ConfigSource -> !FileSource [value] :: ConfigSource -> !(Value Value) Env :: !Text -> !(Value Value) -> ConfigSource [envVar] :: ConfigSource -> !Text [value] :: ConfigSource -> !(Value Value) Cli :: !(Value Value) -> ConfigSource [value] :: ConfigSource -> !(Value Value) Default :: !(Value Value) -> ConfigSource [value] :: ConfigSource -> !(Value Value) None :: ConfigSource data FileSource FilePathSource :: !Text -> FileSource [fileSourcePath] :: FileSource -> !Text EnvVarFileSource :: !Text -> !Text -> FileSource [fileSourceEnvVar] :: FileSource -> !Text [fileSourcePath] :: FileSource -> !Text data Value a Plain :: !a -> Value a [fromValue] :: Value a -> !a Sensitive :: !a -> Value a [fromValue] :: Value a -> !a markAsSensitive :: Bool -> (a -> Value a) deepMerge :: ConfigValue -> ConfigValue -> ConfigValue isEmptySubConfig :: ConfigValue -> Bool emptySubConfig :: ConfigValue writeInSubConfig :: Text -> ConfigValue -> ConfigValue -> ConfigValue filterMaybe :: (a -> Bool) -> Maybe a -> Maybe a data ConfigValueType instance GHC.Base.Monoid System.Etc.Internal.Types.Config instance GHC.Base.Semigroup System.Etc.Internal.Types.Config instance GHC.Show.Show System.Etc.Internal.Types.Config instance GHC.Classes.Eq System.Etc.Internal.Types.Config instance GHC.Show.Show System.Etc.Internal.Types.ConfigValue instance GHC.Classes.Eq System.Etc.Internal.Types.ConfigValue instance GHC.Classes.Eq System.Etc.Internal.Types.ConfigSource instance GHC.Show.Show System.Etc.Internal.Types.ConfigSource instance GHC.Classes.Eq System.Etc.Internal.Types.FileSource instance GHC.Show.Show System.Etc.Internal.Types.FileSource instance GHC.Classes.Ord a => GHC.Classes.Ord (System.Etc.Internal.Types.Value a) instance GHC.Classes.Eq a => GHC.Classes.Eq (System.Etc.Internal.Types.Value a) instance GHC.Generics.Generic (System.Etc.Internal.Types.Value a) instance GHC.Base.Semigroup System.Etc.Internal.Types.ConfigValue instance GHC.Base.Monoid System.Etc.Internal.Types.ConfigValue instance GHC.Classes.Ord System.Etc.Internal.Types.ConfigSource instance GHC.Show.Show a => GHC.Show.Show (System.Etc.Internal.Types.Value a) instance GHC.Base.Functor System.Etc.Internal.Types.Value instance GHC.Base.Applicative System.Etc.Internal.Types.Value instance Data.String.IsString a => Data.String.IsString (System.Etc.Internal.Types.Value a) module System.Etc.Internal.Resolver.File -- | Gathers configuration values from a list of files specified on the -- etc/filepaths entry of a Config Spec. This will return a -- Configuration Map with values from all filepaths merged in, and a list -- of errors in case there was an error reading one of the filepaths. resolveFiles :: ConfigSpec cmd -> IO (Config, Vector SomeException) instance GHC.Classes.Eq System.Etc.Internal.Resolver.File.ConfigFile instance GHC.Show.Show System.Etc.Internal.Resolver.File.ConfigFile module System.Etc.Internal.Resolver.Env -- | Gathers all OS Environment Variable values (env entries) from -- the etc/spec entries inside a ConfigSpec resolveEnv :: ConfigSpec cmd -> IO Config -- | Gathers all OS Environment Variable values (env entries) from -- the etc/spec entries inside a ConfigSpec. This -- version of the function gathers the input from a list of tuples rather -- than the OS. resolveEnvPure :: ConfigSpec cmd -> [(Text, Text)] -> Config module System.Etc.Internal.Resolver.Default -- | Gathers all default values from the etc/spec entries inside a -- ConfigSpec resolveDefault :: ConfigSpec cmd -> Config module System.Etc.Internal.Config configValueToJsonObject :: ConfigValue -> Value _getConfigValueWith :: MonadThrow m => (Value -> Parser result) -> [Text] -> Config -> m result _getSelectedConfigSource :: (MonadThrow m) => [Text] -> Config -> m ConfigSource _getAllConfigSources :: (MonadThrow m) => [Text] -> Config -> m (Set ConfigSource) _getConfigValue :: (MonadThrow m, FromJSON result) => [Text] -> Config -> m result instance System.Etc.Internal.Types.IConfig System.Etc.Internal.Types.Config module System.Etc.Spec data ConfigSpec cmd data ConfigValue cmd -- | Parses a text input into a ConfigSpec, input can be JSON or -- YAML (if cabal flag is set). parseConfigSpec :: (MonadThrow m) => Text -> m (ConfigSpec ()) -- | Reads a specified FilePath and parses a ConfigSpec at -- compilation time. readConfigSpecTH :: (Lift k, FromJSON k) => Proxy k -> Text -> ExpQ -- | Reads contents of a file and parses into a ConfigSpec, file -- contents can be either JSON or YAML (if cabal flag is set). readConfigSpec :: Text -> IO (ConfigSpec ()) module System.Etc data Config class IConfig config data Value a Plain :: !a -> Value a [fromValue] :: Value a -> !a Sensitive :: !a -> Value a [fromValue] :: Value a -> !a -- | 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
--   
getConfigValue :: (IConfig config, MonadThrow m, FromJSON result) => [Text] -> config -> 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 {...})
--   
getConfigValueWith :: (IConfig config, (MonadThrow m)) => (Value -> Parser result) -> [Text] -> config -> m result getSelectedConfigSource :: (IConfig config, (MonadThrow m)) => [Text] -> config -> m ConfigSource getAllConfigSources :: (IConfig config, (MonadThrow m)) => [Text] -> config -> m (Set ConfigSource) data ConfigSource File :: !Int -> !FileSource -> !(Value Value) -> ConfigSource [configIndex] :: ConfigSource -> !Int [filepath] :: ConfigSource -> !FileSource [value] :: ConfigSource -> !(Value Value) Env :: !Text -> !(Value Value) -> ConfigSource [envVar] :: ConfigSource -> !Text [value] :: ConfigSource -> !(Value Value) Cli :: !(Value Value) -> ConfigSource [value] :: ConfigSource -> !(Value Value) Default :: !(Value Value) -> ConfigSource [value] :: ConfigSource -> !(Value Value) None :: ConfigSource data ConfigValue data ConfigSpec cmd -- | Parses a text input into a ConfigSpec, input can be JSON or -- YAML (if cabal flag is set). parseConfigSpec :: (MonadThrow m) => Text -> m (ConfigSpec ()) -- | Reads contents of a file and parses into a ConfigSpec, file -- contents can be either JSON or YAML (if cabal flag is set). readConfigSpec :: Text -> IO (ConfigSpec ()) -- | Reads a specified FilePath and parses a ConfigSpec at -- compilation time. readConfigSpecTH :: (Lift k, FromJSON k) => Proxy k -> Text -> ExpQ -- | Thrown when calling the getConfig or getConfigWith -- functions on a key that does not exist in the configuration spec newtype InvalidConfigKeyPath InvalidConfigKeyPath :: [Text] -> InvalidConfigKeyPath -- | Input Keys [$sel:inputKeys:InvalidConfigKeyPath] :: InvalidConfigKeyPath -> [Text] -- | Thrown when there is a type mismatch in a JSON parser given via -- getConfigWith data ConfigValueParserFailed ConfigValueParserFailed :: ![Text] -> !Text -> ConfigValueParserFailed -- | Input Keys [$sel:inputKeys:ConfigValueParserFailed] :: ConfigValueParserFailed -> ![Text] -- | Parser Error Message [$sel:parserErrorMessage:ConfigValueParserFailed] :: ConfigValueParserFailed -> !Text -- | Thrown when the resolveFile function finds a key on a -- configuration file that is not specified in the given configuration -- spec data UnknownConfigKeyFound UnknownConfigKeyFound :: ![Text] -> !Text -> ![Text] -> UnknownConfigKeyFound -- | Parent Keys [$sel:parentKeys:UnknownConfigKeyFound] :: UnknownConfigKeyFound -> ![Text] -- | Key Name [$sel:keyName:UnknownConfigKeyFound] :: UnknownConfigKeyFound -> !Text -- | Sibling Keys (other keys in the same level) [$sel:siblingKeys:UnknownConfigKeyFound] :: UnknownConfigKeyFound -> ![Text] -- | Thrown when there is a type mismatch on a configuration entry, -- specifically, when there is a raw value instead of a sub-config in a -- configuration file data SubConfigEntryExpected SubConfigEntryExpected :: !Text -> !Value -> SubConfigEntryExpected -- | Key Name [$sel:keyName:SubConfigEntryExpected] :: SubConfigEntryExpected -> !Text -- | Config Value [$sel:configValue:SubConfigEntryExpected] :: SubConfigEntryExpected -> !Value -- | This error is thrown when a type mismatch is found in a raw value when -- calling resolveFile data ConfigValueTypeMismatchFound ConfigValueTypeMismatchFound :: !Text -> !Value -> !ConfigValueType -> ConfigValueTypeMismatchFound -- | Key Name [$sel:keyName:ConfigValueTypeMismatchFound] :: ConfigValueTypeMismatchFound -> !Text -- | Config Value [$sel:configValueEntry:ConfigValueTypeMismatchFound] :: ConfigValueTypeMismatchFound -> !Value -- | Config Value Type [$sel:configValueEntryType:ConfigValueTypeMismatchFound] :: ConfigValueTypeMismatchFound -> !ConfigValueType -- | Thrown when a specified configuration file is not found in the system newtype ConfigurationFileNotFound ConfigurationFileNotFound :: Text -> ConfigurationFileNotFound -- | Config FilePath [$sel:configFilepath:ConfigurationFileNotFound] :: ConfigurationFileNotFound -> Text -- | Thrown when an input configuration file contains an unsupported file -- extension newtype UnsupportedFileExtensionGiven UnsupportedFileExtensionGiven :: Text -> UnsupportedFileExtensionGiven -- | Config FilePath [$sel:configFilepath:UnsupportedFileExtensionGiven] :: UnsupportedFileExtensionGiven -> Text -- | Thrown when an input configuration file contains invalid syntax data ConfigInvalidSyntaxFound ConfigInvalidSyntaxFound :: !Text -> !Text -> ConfigInvalidSyntaxFound -- | Config FilePath [$sel:configFilepath:ConfigInvalidSyntaxFound] :: ConfigInvalidSyntaxFound -> !Text -- | Parser Error Message [$sel:parserErrorMessage:ConfigInvalidSyntaxFound] :: ConfigInvalidSyntaxFound -> !Text -- | Thrown when an configuration spec file contains invalid syntax data SpecInvalidSyntaxFound SpecInvalidSyntaxFound :: !(Maybe Text) -> !Text -> SpecInvalidSyntaxFound -- | Spec FilePath [$sel:specFilepath:SpecInvalidSyntaxFound] :: SpecInvalidSyntaxFound -> !(Maybe Text) -- | Parser Error Message [$sel:parseErrorMessage:SpecInvalidSyntaxFound] :: SpecInvalidSyntaxFound -> !Text -- | Gathers all default values from the etc/spec entries inside a -- ConfigSpec resolveDefault :: ConfigSpec cmd -> Config -- | Gathers configuration values from a list of files specified on the -- etc/filepaths entry of a Config Spec. This will return a -- Configuration Map with values from all filepaths merged in, and a list -- of errors in case there was an error reading one of the filepaths. resolveFiles :: ConfigSpec cmd -> IO (Config, Vector SomeException) -- | Gathers all OS Environment Variable values (env entries) from -- the etc/spec entries inside a ConfigSpec. This -- version of the function gathers the input from a list of tuples rather -- than the OS. resolveEnvPure :: ConfigSpec cmd -> [(Text, Text)] -> Config -- | Gathers all OS Environment Variable values (env entries) from -- the etc/spec entries inside a ConfigSpec resolveEnv :: ConfigSpec cmd -> IO Config