Copyright | (c) 2019-2020 Vaclav Svejcar |
---|---|
License | BSD-3 |
Maintainer | vaclav.svejcar@gmail.com |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
This module provides logic for working with the cofiguration data types.
Headroom uses the
partial options monoid
pattern for the configuration, where the Configuration
is the data type for
total configuration and PartialConfiguration
for the partial one.
Synopsis
- loadConfiguration :: MonadIO m => FilePath -> m PartialConfiguration
- parseConfiguration :: MonadThrow m => ByteString -> m PartialConfiguration
- parseVariables :: MonadThrow m => [Text] -> m (HashMap Text Text)
- makeConfiguration :: MonadThrow m => PartialConfiguration -> m Configuration
- makeHeadersConfig :: MonadThrow m => PartialHeadersConfig -> m HeadersConfig
- makeHeaderConfig :: MonadThrow m => FileType -> PartialHeaderConfig -> m HeaderConfig
Loading & Parsing Configuration
:: MonadIO m | |
=> FilePath | path to YAML configuration file |
-> m PartialConfiguration | parsed configuration |
Loads and parses application configuration from given YAML file.
:: MonadThrow m | |
=> ByteString | raw input to parse |
-> m PartialConfiguration | parsed application configuration |
Parses application configuration from given raw input in YAML format.
Parses variables from raw input in key=value
format.
>>>
parseVariables ["key1=value1"]
fromList [("key1","value1")]
Processing Partial Configuration
:: MonadThrow m | |
=> PartialConfiguration | source |
-> m Configuration | full |
Makes full Configuration
from provided PartialConfiguration
(if valid).
:: MonadThrow m | |
=> PartialHeadersConfig | source |
-> m HeadersConfig | full |
Makes full HeadersConfig
from provided PartialHeadersConfig
(if valid).
:: MonadThrow m | |
=> FileType | determines for which file type this configuration is |
-> PartialHeaderConfig | source |
-> m HeaderConfig | full |
Makes full HeaderConfig
from provided PartialHeaderConfig
(if valid).