2020-10-19 17:37:54 -06:00
|
|
|
# [dotenv](https://git.rootprojects.org/root/dotenv)
|
|
|
|
|
|
|
|
A cross-platform tool to run a command with environment variables loaded from a given .env file.
|
|
|
|
|
|
|
|
**Example**:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
dotenv -f .env -- node server.js
|
|
|
|
```
|
|
|
|
|
|
|
|
## Install
|
|
|
|
|
|
|
|
**Mac**, **Linux**:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
curl -sS https://webinstall.dev/dotenv | bash
|
|
|
|
```
|
|
|
|
|
|
|
|
**Windows 10**:
|
|
|
|
|
|
|
|
```pwsh
|
|
|
|
curl -A MS https://webinstall.dev/dotenv | powershell
|
|
|
|
```
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
```bash
|
2020-10-19 17:59:14 -06:00
|
|
|
dotenv v1.0.0 (17c7677) 2020-10-19T23:43:57Z
|
2020-10-19 17:37:54 -06:00
|
|
|
|
|
|
|
Usage:
|
2020-10-19 23:22:11 -06:00
|
|
|
dotenv [-f .env.alternate] -- <command> [arguments...]
|
2020-10-19 17:37:54 -06:00
|
|
|
|
|
|
|
-f string
|
|
|
|
path to .env file (default ".env")
|
2020-10-19 17:59:14 -06:00
|
|
|
--help
|
2020-10-19 17:37:54 -06:00
|
|
|
print usage and exit
|
2020-10-19 17:59:14 -06:00
|
|
|
--version
|
2020-10-19 17:37:54 -06:00
|
|
|
print version and exit
|
|
|
|
|
|
|
|
Example:
|
|
|
|
dotenv -f .env -- caddy run --config Caddyfile
|
|
|
|
```
|
|
|
|
|
|
|
|
## Build
|
|
|
|
|
|
|
|
`dotenv` is written in Go, using [github.com/joho/godotenv](https://github.com/joho/godotenv).
|
|
|
|
|
|
|
|
Install Go:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
curl -sS https://webinstall.dev/golang | bash
|
|
|
|
```
|
|
|
|
|
|
|
|
(see https://webinstall.dev/golang for details)
|
|
|
|
|
|
|
|
### Manually
|
|
|
|
|
|
|
|
```bash
|
|
|
|
export GOFLAGS="-mod=vendor"
|
|
|
|
go generate -mod=vendor ./...
|
2020-10-19 17:59:14 -06:00
|
|
|
go run -mod=vendor git.rootprojects.org/root/go-gitver/v2
|
2020-10-19 17:37:54 -06:00
|
|
|
go build -mod=vendor .
|
|
|
|
```
|
|
|
|
|
|
|
|
```bash
|
|
|
|
./dotenv --version
|
|
|
|
```
|
|
|
|
|
|
|
|
### With GoReleaser
|
|
|
|
|
|
|
|
Install GoReleaser:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
curl -sS https://webinstall.dev/goreleaser | bash
|
|
|
|
```
|
|
|
|
|
|
|
|
```bash
|
|
|
|
goreleaser --snapshot --skip-publish --rm-dist
|
|
|
|
```
|
|
|
|
|
2020-10-19 17:59:14 -06:00
|
|
|
```bash
|
|
|
|
./dist/dotenv_darwin_amd64/dotenv --version
|
|
|
|
```
|
|
|
|
|
2020-10-19 17:37:54 -06:00
|
|
|
## License
|
|
|
|
|
|
|
|
Copyright 2020 The dotenv Authors.
|
|
|
|
|
|
|
|
This Source Code Form is subject to the terms of the Mozilla Public \
|
|
|
|
License, v. 2.0. If a copy of the MPL was not distributed with this \
|
|
|
|
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|