Safe Haskell | None |
---|---|
Language | Haskell2010 |
Include the value of an environment variable in the binary at compile time.
Rationale
Users might want to embed secrets (e.g. API keys, database connection strings) inside production artifacts without checking these into the repository.
Example
import IncludeEnv.TH (includeEnv)
$(includeEnv
"SHELL" "shl")
shl :: String
main :: IO ()
main = putStrLn $ unwords ["your current shell :", shl]
Synopsis
- includeEnv :: String -> String -> Q [Dec]
- includeEnvLenient :: String -> String -> Q [Dec]
Documentation
Like includeEnv
but only prints a warning if the environment variable cannot be found.
NB : If the lookup fails, the declared value will contain an empty string.