| Copyright | (c) 2019-2020 Vaclav Svejcar |
|---|---|
| License | BSD-3 |
| Maintainer | vaclav.svejcar@gmail.com |
| Stability | experimental |
| Portability | POSIX |
| Safe Haskell | None |
| Language | Haskell2010 |
Headroom.AppConfig
Description
Synopsis
- data AppConfig = AppConfig {
- acRunMode :: RunMode
- acSourcePaths :: [FilePath]
- acTemplatePaths :: [FilePath]
- acVariables :: HashMap Text Text
- loadAppConfig :: MonadIO m => FilePath -> m AppConfig
- makePathsRelativeTo :: FilePath -> AppConfig -> AppConfig
- parseAppConfig :: MonadThrow m => ByteString -> m AppConfig
- parseVariables :: MonadThrow m => [Text] -> m (HashMap Text Text)
- validateAppConfig :: MonadThrow m => AppConfig -> m AppConfig
Documentation
Application configuration, loaded either from configuration file or command line options.
Constructors
| AppConfig | |
Fields
| |
Instances
| Eq AppConfig Source # | |
| Show AppConfig Source # | |
| Generic AppConfig Source # | |
| Semigroup AppConfig Source # | |
| Monoid AppConfig Source # | |
| FromJSON AppConfig Source # | Support for reading configuration from YAML. |
Defined in Headroom.AppConfig | |
| type Rep AppConfig Source # | |
Defined in Headroom.AppConfig type Rep AppConfig = D1 ('MetaData "AppConfig" "Headroom.AppConfig" "headroom-0.1.1.0-inplace" 'False) (C1 ('MetaCons "AppConfig" 'PrefixI 'True) ((S1 ('MetaSel ('Just "acRunMode") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 RunMode) :*: S1 ('MetaSel ('Just "acSourcePaths") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [FilePath])) :*: (S1 ('MetaSel ('Just "acTemplatePaths") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [FilePath]) :*: S1 ('MetaSel ('Just "acVariables") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (HashMap Text Text))))) | |
Loads and parses application configuration from given file.
Arguments
| :: FilePath | file path to use |
| -> AppConfig | input application configuration |
| -> AppConfig | result with relativized file paths |
Rewrites all file paths in AppConfig to be relative to given file path.
Arguments
| :: MonadThrow m | |
| => ByteString | raw input to parse |
| -> m AppConfig | parsed application configuration |
Parses application configuration from given raw input.
Parses variables from raw input in key=value format.
>>>parseVariables ["key1=value1"]fromList [("key1","value1")]