-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Include the value of an environment variable at compile time -- -- Embed secrets (e.g. API keys) inside production artifacts at compile -- time. @package include-env @version 0.5.0.0 -- | Include the value of an environment variable in the binary at compile -- time. -- --
-- import IncludeEnv.TH (includeEnv) -- -- $(includeEnv "SHELL" "shl") -- shl :: String -- -- main :: IO () -- main = putStrLn $ unwords ["your current shell :", shl] ---- --
-- import IncludeEnv.TH (includeEnvMap) -- -- env = $(includeEnvMap ["TERM", "USER"]) ---- --
-- >>> env
-- fromList [("TERM","dumb"),("USER","marco")]
--
module IncludeEnv.TH
-- | Include the value of an environment variable at compile time.
--
-- A fresh variable of type String is declared each time this is
-- computation is evaluated.
--
-- Note : will crash with error if the environment variable is not
-- found.
includeEnv :: String -> String -> Q [Dec]
-- | 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_ .
includeEnvLenient :: String -> String -> Q [Dec]
-- | Like includeEnv but produces a 'Maybe String'
--
-- Use case : The program needs to be compiled against two different
-- environments that may have different sets of environment variables.
-- includeEnvMaybe lets you account for the results of multiple
-- such lookups at runtime.
includeEnvMaybe :: String -> Q Exp
-- | Lookup a number of environment variables and populate a Map
-- with the result
--
-- NB: if a variable name cannot be found, the corresponding entry will
-- be missing
includeEnvMap :: Foldable t => t String -> Q Exp