load-env: Load environment variables from a file.

[ bsd3, configuration, library ] [ Propose Tags ]

Parse a .env file and load any declared variables into the current process's environment. This allows for a .env file to specify development-friendly defaults for configuration values normally set in the deployment environment.

[Skip to Readme]
Versions 0.0.1, 0.0.2, 0.0.3, 0.0.4, 0.0.5, 0.1.0, 0.1.1, 0.1.2,,
Change log CHANGELOG.md
Dependencies base (>=4.8.0 && <5), directory, filepath, parsec [details]
License BSD-3-Clause
Author Pat Brisbin <pbrisbin@gmail.com>
Maintainer Pat Brisbin <pbrisbin@gmail.com>
Category Configuration
Home page https://github.com/pbrisbin/load-env#readme
Bug tracker https://github.com/pbrisbin/load-env/issues
Source repo head: git clone https://github.com/pbrisbin/load-env
Uploaded by PatrickBrisbin at Fri May 25 20:14:05 UTC 2018
Distributions LTSHaskell:0.1.2, NixOS:, Stackage:, openSUSE:0.1.2
Downloads 2744 total (83 in the last 30 days)
Rating (no votes yet) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2018-05-25 [all 1 reports]
Hackage Matrix CI




Maintainer's Corner

For package maintainers and hackage trustees

Readme for load-env-

[back to package description]


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.


import LoadEnv
import System.Environment (lookupEnv)

main :: IO ()
main = do

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

Development & Test

stack setup
stack build --pedantic --test