BSD-3-Clause licensed and maintained by Pat Brisbin
This version can be pinned in stack with:load-env-0.2.0.2@sha256:1cc305683eea4791d632f3acbf0c3373cf760717eeaeef373c17a8709221ab93,1869

Module documentation for 0.2.0.2

Used by 1 package in lts-13.19(full list with versions):

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

Changes

Unreleased

None

v0.2.0.2

v0.2.0.1

  • Packaging and documentation updates

v0.2.0.0

  • Traverse up parent directories to find the .env file

v0.1.2

  • Packaging updates

v0.1.1

  • Parse variables names more strictly

v0.1.0

  • Don’t fail on an empty file
  • Ignore any invalid lines, not specifically things that look like comments

v0.0.4

  • Don’t throw an exception if the .env file is missing

v0.0.3

  • Variable names can contain underscores

v0.0.2

  • Drop support for GHC < 7.8

v0.0.1

Initial release.