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]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.0.1, 0.0.2, 0.0.3, 0.0.4, 0.0.5, 0.1.0, 0.1.1, 0.1.2, 0.2.0.0, 0.2.0.1, 0.2.0.2, 0.2.1.0
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 2018-10-12T20:27:50Z
Distributions Debian:0.2.1.0, LTSHaskell:0.2.1.0, NixOS:0.2.1.0, Stackage:0.2.1.0
Reverse Dependencies 3 direct, 0 indirect [details]
Downloads 9308 total (43 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2018-10-12 [all 1 reports]

Readme for load-env-0.2.0.2

[back to package description]

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