add dotenv
[webi-installers/.git] / dotenv / README.md
1 ---
2 title: dotenv
3 homepage: https://github.com/therootcompany/dotenv
4 tagline: |
5   dotenv: a cross-platform tool to load a .env and run a command.
6 ---
7
8 ## Updating `dotenv`
9
10 ```bash
11 webi dotenv@stable
12 ```
13
14 Use the `@beta` tag for pre-releases, or `@x.y.z` for a specific version.
15
16 ## Cheat Sheet
17
18 > dotenv makes it easy to run a command with a set of ENVs (environment
19 > variables) from a .env file. It works cross platform, and with any programming
20 > environment (Node.js, Go, Rust, Ruby, Python, etc)
21
22 ```bash
23 # Usage: dotenv [-f .env.alt] -- <command> [arguments]
24
25 # Example:
26 dotenv -f .env -- node server.js --debug
27 ```
28
29 ## How Precedence Works
30
31 1. command line flags
32    - ex: `--port 8080`
33 2. existing environment variables
34    - ex: `export PORT=8080` or `env PORT=8080 mycommand`
35 3. first-loaded wins for multiple or cascading .env.\* files
36    - ex: `dotenv -f .env,.env.local`
37
38 ## ENV syntax
39
40 ```txt
41 # comments and blank lines are ignored
42
43 # you can use quotes of either style
44 FOO=bar
45 FOO2="bar2 bar3"
46 FOO3='bar2 bar3'
47
48 # 'export' will be trimmed and ignored
49 # (yay for bash compatibility)
50 export FOOBAR=excellent
51 ```
52
53 ## Why --?
54
55 The `--` is a common convention for arguments parsers to let them know that
56 everything after the `--` should be treated as an argument (a word) rather than
57 a flag (not something like `--help`).
58
59 You should use this whenever one command runs another command.