Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Synopsis
- mkEnvProvider :: Prefix -> ProviderCreator
- mkEnvProvider' :: LookupEnvFunc -> Prefix -> ProviderCreator
- type Prefix = Text
- type LookupEnvFunc = String -> IO (Maybe String)
- keyToEnvVar :: Prefix -> Key -> Text
Env Provider
This Provider
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 provider will try to lookup the env var called
AWESOMEAPP_WARP_PORT
.
Usage
To use this provider simply choose a prefix and add it using the
addProvider
function like:
config &addProvider
(mkEnvProvider
"awesomeapp")
mkEnvProvider :: Prefix -> ProviderCreator Source #
ProviderCreator
for env Provider
that uses the real lookupEnv
function
mkEnvProvider' :: LookupEnvFunc -> Prefix -> ProviderCreator Source #
ProviderCreator
for env Provider
that allows parameterizing the
function used to lookup for testing