Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Synopsis
- mkEnvSource :: Prefix -> SourceCreator
- mkEnvSource' :: LookupEnvFunc -> Prefix -> SourceCreator
- type Prefix = Text
- type LookupEnvFunc = String -> IO (Maybe String)
- keyToEnvVar :: Prefix -> Key -> Text
Env Source
This Source
provides config values from env vars given a prefix that's
used to avoid colliding with different system configuration
For example if you use the Prefix
"awesomeapp" and get the Key
"warp.port" this source will try to lookup the env var called
AWESOMEAPP_WARP_PORT
.
Usage
To use this source simply choose a prefix and add it using the
addSource
function like:
config &addSource
(mkEnvSource
"awesomeapp")
mkEnvSource :: Prefix -> SourceCreator Source #
SourceCreator
for env Source
that uses the real lookupEnv
function
mkEnvSource' :: LookupEnvFunc -> Prefix -> SourceCreator Source #
SourceCreator
for env Source
that allows parameterizing the
function used to lookup for testing