File: README.md

package info (click to toggle)
haskell-load-env 0.2.1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 92 kB
  • sloc: haskell: 249; makefile: 5
file content (51 lines) | stat: -rw-r--r-- 1,203 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# load-env

[![Build Status](https://circleci.com/gh/pbrisbin/load-env/tree/master.png)](https://circleci.com/gh/pbrisbin/load-env)

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.

[dotenv]: https://github.com/bkeepers/dotenv

This library exposes functions for doing just that.

## Usage

```haskell
import LoadEnv
import System.Environment (lookupEnv)

main :: IO ()
main = do
    loadEnv

    print =<< lookupEnv "FOO"
```

```console
% cat .env
FOO=bar
% runhaskell main.hs
Just "bar"
```

## Development & Test

```
stack setup
stack build --pedantic --test
```

---

[CHANGELOG](./CHANGELOG.md) | [LICENSE](./LICENSE)