summaryrefslogtreecommitdiff
path: root/README.md
blob: 2e971738f6a0299bfa244b72e96d0001a22ab7c3 (plain)
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
# env Library

Works like sh env, but is file based.

## Design goals

* backwards compatible: saved files are compatible with bash env syntax
* simple:               only string key=value pairs
* concurrent:           use file locks
* global:               env functions can be called from anywhere
* dynamic:              automaticly detect env changes by the file mtime

## Theory of Operation

The core philosophy of this library is to standardize env in a new way

env configuration files are loaded in this defined order:

1.  /usr/share/doc/foo/foo.env  # upstream application defaults
2.  /etc/foo/foo.env            # OS distribution defaults
3.  /etc/default/foo            # system admin overrides
4.  ~/.config/foo/foo.env       # your user settings

## function examples

```
key := env.Get("APIKEY")

if env.True("verbose") {
    fmt.Println("worked")
}

env.Set("LocalPort", "8080")
```