dotenv-0.10.0.0: Loads environment variables from dotenv files
Copyright© 2015–2020 Stack Builders Inc.
LicenseMIT
MaintainerStack Builders <hackage@stackbuilders.com>
Stabilityexperimental
Portabilityportable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Configuration.Dotenv

Description

This module contains common functions to load and read dotenv files.

Synopsis

Dotenv Load Functions

load Source #

Arguments

:: MonadIO m 
=> Bool

Override existing settings?

-> [(String, String)]

List of values to be set in environment

-> m () 

Loads the given list of options into the environment. Optionally override existing variables with values from Dotenv files.

loadFile Source #

Arguments

:: MonadIO m 
=> Config

Dotenv configuration

-> 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.

parseFile Source #

Arguments

:: MonadIO m 
=> FilePath

A file containing options to read

-> m [(String, String)]

Variables contained in the file

Parses the given dotenv file and returns values without adding them to the environment.

onMissingFile Source #

Arguments

:: MonadCatch m 
=> m a

Action to perform that may fail because of missing file

-> m a

Action to perform if file is indeed missing

-> m a 

The helper allows to avoid exceptions in the case of missing files and perform some action instead.

Since: 0.3.1.0

Dotenv Types

data ReaderT r m a Source #

Instances

Instances details
Monad m => Monad (ReaderT r m) Source # 
Instance details

Defined in Configuration.Dotenv.Types

Methods

(>>=) :: ReaderT r m a -> (a -> ReaderT r m b) -> ReaderT r m b #

(>>) :: ReaderT r m a -> ReaderT r m b -> ReaderT r m b #

return :: a -> ReaderT r m a #

Functor m => Functor (ReaderT r m) Source # 
Instance details

Defined in Configuration.Dotenv.Types

Methods

fmap :: (a -> b) -> ReaderT r m a -> ReaderT r m b #

(<$) :: a -> ReaderT r m b -> ReaderT r m a #

Applicative m => Applicative (ReaderT r m) Source # 
Instance details

Defined in Configuration.Dotenv.Types

Methods

pure :: a -> ReaderT r m a #

(<*>) :: ReaderT r m (a -> b) -> ReaderT r m a -> ReaderT r m b #

liftA2 :: (a -> b -> c) -> ReaderT r m a -> ReaderT r m b -> ReaderT r m c #

(*>) :: ReaderT r m a -> ReaderT r m b -> ReaderT r m b #

(<*) :: ReaderT r m a -> ReaderT r m b -> ReaderT r m a #

data Config Source #

Configuration Data Types with extra options for executing dotenv.

Constructors

Config 

Fields

Instances

Instances details
Eq Config Source # 
Instance details

Defined in Configuration.Dotenv.Types

Methods

(==) :: Config -> Config -> Bool #

(/=) :: Config -> Config -> Bool #

Show Config Source # 
Instance details

Defined in Configuration.Dotenv.Types

defaultConfig :: Config Source #

Default configuration. Use .env file without .env.example strict envs and without overriding.

liftReaderT :: m a -> ReaderT r m a Source #

ask :: Monad m => ReaderT r m r Source #