Copyright | (c) 2019 Lucas David Traverso |
---|---|
License | MPL-2.0 |
Maintainer | Lucas David Traverso <lucas6246@gmail.com> |
Stability | stable |
Portability | portable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Environment based source
Synopsis
- data EnvSource = EnvSource {}
- type RawEnvironment = [(String, String)]
- type Prefix = Text
- fromConfig :: Prefix -> SourceCreator
- fromEnv :: Prefix -> IO Source
- fromEnvList :: RawEnvironment -> Prefix -> Source
- keyToEnvVar :: Prefix -> Key -> Text
- envVarToKey :: Prefix -> Text -> Maybe Key
Documentation
Source that interfaces with the environment transforming keys by uppercasing and interspersing underscores, and using a prefix to avoid clashing with system env vars
so with "app" prefix, "some.key"
turns into APP_SOME_KEY
type RawEnvironment = [(String, String)] Source #
Type alias for the environment
fromConfig :: Prefix -> SourceCreator Source #
Create a SourceCreator
using fromEnv
fromEnvList :: RawEnvironment -> Prefix -> Source Source #
Create a Source
using a hardcoded list of env vars
keyToEnvVar :: Prefix -> Key -> Text Source #
Get the env name from a prefix and a key by uppercasing and intercalating underscores
envVarToKey :: Prefix -> Text -> Maybe Key Source #
The opossite of keyToEnvVar