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