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, 0.2.0.0, 0.2.0.1, 0.2.0.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 Oct 12 20:27:50 UTC 2018
Distributions Debian:0.2.0.1, LTSHaskell:0.2.0.2, NixOS:0.2.0.2, Stackage:0.2.0.2
Downloads 3051 total (36 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-10-12 [all 1 reports]
Hackage Matrix CI

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees


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