-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Loads environment variables from dotenv files -- -- In most applications, configuration should be separated from -- code. While it usually works well to keep configuration in the -- environment, there are cases where you may want to store configuration -- in a file outside of version control. -- -- Dotenv files have become popular for storing configuration, -- especially in development and test environments. In Ruby, -- Python and Javascript there are libraries to facilitate -- loading of configuration options from configuration files. This -- library loads configuration to environment variables for programs -- written in Haskell. -- -- To use, call loadFile from your application: -- --
--   import Control.Monad (void)
--   import Configuration.Dotenv
--   void $ loadFile defaultConfig
--   
-- -- This package also includes an executable that can be used to inspect -- the results of applying one or more Dotenv files to the environment, -- or for invoking your executables with an environment after one or more -- Dotenv files is applied. -- -- See the Github page for more information on this package. @package dotenv @version 0.6.0.2 -- | Helpers to interpolate environment variables module Configuration.Dotenv.ParsedVariable data ParsedVariable ParsedVariable :: VarName -> VarValue -> ParsedVariable type VarName = String data VarValue Unquoted :: VarContents -> VarValue SingleQuoted :: VarContents -> VarValue DoubleQuoted :: VarContents -> VarValue type VarContents = [VarFragment] data VarFragment VarInterpolation :: String -> VarFragment VarLiteral :: String -> VarFragment CommandInterpolation :: String -> VarFragment interpolateParsedVariables :: [ParsedVariable] -> IO [(String, String)] instance GHC.Classes.Eq Configuration.Dotenv.ParsedVariable.ParsedVariable instance GHC.Show.Show Configuration.Dotenv.ParsedVariable.ParsedVariable instance GHC.Classes.Eq Configuration.Dotenv.ParsedVariable.VarValue instance GHC.Show.Show Configuration.Dotenv.ParsedVariable.VarValue instance GHC.Classes.Eq Configuration.Dotenv.ParsedVariable.VarFragment instance GHC.Show.Show Configuration.Dotenv.ParsedVariable.VarFragment -- | Parser for files in dotenv format. These files generally consist of -- lines with the form key=value. Comments and blank lines are also -- supported. More information on the dotenv format can be found in the -- project README and the test suite. module Configuration.Dotenv.Parse -- | Returns a parser for a Dotenv configuration file. Accepts key and -- value arguments separated by =. Comments in all positions are -- handled appropriately. configParser :: Parser [ParsedVariable] -- | Types for loadSafeFile (e. g., ValidatorMap) module Configuration.Dotenv.Scheme.Types newtype EnvType EnvType :: Text -> EnvType data Env Env :: String -> EnvType -> Bool -> Env [envName] :: Env -> String [envType] :: Env -> EnvType [required] :: Env -> Bool -- | Parameters: -- -- type ValidatorMap = Map Text (Text -> Bool) -- | Default configuration for loadSafeFile. It currently checks: -- bool, integer, and text. defaultValidatorMap :: ValidatorMap instance GHC.Classes.Ord Configuration.Dotenv.Scheme.Types.Env instance GHC.Classes.Eq Configuration.Dotenv.Scheme.Types.Env instance GHC.Show.Show Configuration.Dotenv.Scheme.Types.Env instance GHC.Classes.Ord Configuration.Dotenv.Scheme.Types.EnvType instance GHC.Classes.Eq Configuration.Dotenv.Scheme.Types.EnvType instance GHC.Show.Show Configuration.Dotenv.Scheme.Types.EnvType instance Data.Aeson.Types.FromJSON.FromJSON Configuration.Dotenv.Scheme.Types.Env instance Data.Aeson.Types.FromJSON.FromJSON Configuration.Dotenv.Scheme.Types.EnvType -- | Helpers for loadSafeFile module Configuration.Dotenv.Scheme.Parser -- | Default configuration for loadSafeFile. It currently checks: -- bool, integer, and text. defaultValidatorMap :: ValidatorMap parseEnvsWithScheme :: ValidatorMap -> [(String, EnvType)] -> Either [String] () typeValidator :: ValidatorMap -> String -> EnvType -> Either String () -- | Helpers for loadSafeFile module Configuration.Dotenv.Scheme.Helpers joinEnvs :: [Env] -> [(String, String)] -> [(Env, (String, String))] matchValueAndType :: [(Env, (String, String))] -> [(String, EnvType)] missingDotenvs :: [Env] -> [(Env, (String, String))] -> [Env] missingSchemeEnvs :: [(String, String)] -> [(Env, (String, String))] -> [(String, String)] sepWithCommas :: [String] -> String showMissingDotenvs :: [Env] -> String showMissingSchemeEnvs :: [(String, String)] -> String -- | Helpers for loadSafeFile module Configuration.Dotenv.Scheme checkConfig :: ValidatorMap -> [(String, String)] -> [Env] -> IO () checkScheme :: [Env] -> [Env] readScheme :: FilePath -> IO [Env] -- | Provides the types with extra options for loading a dotenv file. module Configuration.Dotenv.Types -- | Configuration Data Types with extra options for executing dotenv. data Config Config :: [FilePath] -> [FilePath] -> Bool -> Config -- | The paths for the .env files [configPath] :: Config -> [FilePath] -- | The paths for the .env.example files [configExamplePath] :: Config -> [FilePath] -- | Flag to allow override env variables [configOverride] :: Config -> Bool -- | Default configuration. Use .env file without .env.example strict envs -- and without overriding. defaultConfig :: Config instance GHC.Show.Show Configuration.Dotenv.Types.Config instance GHC.Classes.Eq Configuration.Dotenv.Types.Config -- | This module contains common functions to load and read dotenv files. module Configuration.Dotenv -- | Loads the given list of options into the environment. Optionally -- override existing variables with values from Dotenv files. load :: MonadIO m => Bool -> [(String, String)] -> m () -- | loadFile parses the environment variables defined in the -- dotenv example file and checks if they are defined in the dotenv file -- or in the environment. It also allows to override the environment -- variables defined in the environment with the values defined in the -- dotenv file. loadFile :: MonadIO m => Config -> m [(String, String)] -- | loadSafeFile parses the .scheme.yml file and will -- perform the type checking of the environment variables in the -- .env file. loadSafeFile :: MonadIO m => ValidatorMap -> FilePath -> Config -> m [(String, String)] -- | Parses the given dotenv file and returns values without adding -- them to the environment. parseFile :: MonadIO m => FilePath -> m [(String, String)] -- | The helper allows to avoid exceptions in the case of missing files and -- perform some action instead. onMissingFile :: MonadCatch m => m a -> m a -> m a -- | Configuration Data Types with extra options for executing dotenv. data Config Config :: [FilePath] -> [FilePath] -> Bool -> Config -- | The paths for the .env files [configPath] :: Config -> [FilePath] -- | The paths for the .env.example files [configExamplePath] :: Config -> [FilePath] -- | Flag to allow override env variables [configOverride] :: Config -> Bool -- | Parameters: -- -- type ValidatorMap = Map Text (Text -> Bool) -- | Default configuration for loadSafeFile. It currently checks: -- bool, integer, and text. defaultValidatorMap :: ValidatorMap -- | Provides a Data.Text interface for retrieving variables in a dotenv -- file. module Configuration.Dotenv.Text -- | Parses the given dotenv file and returns values without adding -- them to the environment. parseFile :: MonadIO m => FilePath -> m [(Text, Text)]