Skip to content
Load environment variables from .env
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci Fix digest strategy on CI May 24, 2018
doctest Implement parent traversal May 24, 2018
src Only set unset variables Jun 12, 2019
test Only set unset variables Jun 12, 2019
.gitignore Update packaging Dec 16, 2017
.hlint.yaml
.stylish-haskell.yaml Configure HLint and stylish-haskell Dec 16, 2017
CHANGELOG.md Version bump Jun 12, 2019
LICENSE Update copyright Dec 16, 2017
Makefile
README.md Fix README formatting Dec 16, 2017
Setup.hs
package.yaml Version bump Jun 12, 2019
stack.yaml Update Stack resolver May 24, 2018

README.md

load-env

Build Status

This is effectively a port of dotenv, whose README explains it best:

Storing configuration in the environment is one of the tenets of a twelve-factor app. Anything that is likely to change between deployment environments–such as resource handles for databases or credentials for external services–should be extracted from the code into environment variables.

But it is not always practical to set environment variables on development machines or continuous integration servers where multiple projects are run. dotenv loads variables from a .env file into ENV when the environment is bootstrapped.

This library exposes functions for doing just that.

Usage

import LoadEnv
import System.Environment (lookupEnv)

main :: IO ()
main = do
    loadEnv

    print =<< lookupEnv "FOO"
% cat .env
FOO=bar
% runhaskell main.hs
Just "bar"

Development & Test

stack setup
stack build --pedantic --test

CHANGELOG | LICENSE

You can’t perform that action at this time.