Copyright | (c) 2019-2020 Vaclav Svejcar |
---|---|
License | BSD-3 |
Maintainer | vaclav.svejcar@gmail.com |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
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)
- prettyPrintAppConfig :: AppConfig -> Text
- validateAppConfig :: MonadThrow m => AppConfig -> m AppConfig
Documentation
Application configuration, loaded either from configuration file or command line options.
AppConfig | |
|
Instances
Loads and parses application configuration from given file.
:: 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.
:: 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")]
Writes the given AppConfig
to YAML text, using the pretty printer.