Deterministic environment configuration management — simple, predictable, and fast.
devenv is a CLI tool for managing environment configurations using a layered TOML config.
Define shared values in [base], add per-environment overrides, and generate a clean output file in dotenv, YAML, or TOML format. No duplication, no surprises.
brew install arashrasoulzadeh/tap/devenvcurl -L https://github.com/arashrasoulzadeh/devenv/releases/latest/download/devenv-linux -o devenv
chmod +x devenv
sudo mv devenv /usr/local/bin/Releases: https://github.com/arashrasoulzadeh/devenv/releases
[output]
name = ".env"
type = "dotenv"
[base]
app_name = "myapp"
db_host = "localhost"
db_user = "root"
[dev]
db_host = "dev.internal"
db_user = "dev_user"
[prod]
db_host = "db.prod.internal"
db_user = "prod_user"devenv devapp_name="myapp"
db_host="dev.internal"
db_user="dev_user"The same config with type = "yaml":
app_name: "myapp"
db_host: "dev.internal"
db_user: "dev_user"Or type = "toml":
app_name = "myapp"
db_host = "dev.internal"
db_user = "dev_user"devenv [environment]Merges [base] with the named environment section and writes the output file.
devenv dev # merge base + [dev], write output
devenv staging # merge base + [staging], write output
devenv prod # merge base + [prod], write output
devenv # write base only (no overlay)devenv env <environment> [--no-values]Compares the merged config for the given environment against your current OS environment and reports any keys that are not set.
devenv env dev # show missing keys with their values
devenv env prod --no-values # show missing keys without exposing values| Command | Description |
|---|---|
devenv help |
Show help |
devenv version |
Show version and build metadata |
| Flag | Description |
|---|---|
--config FILE |
Use a custom config file path (default: config.toml) |
--dont-commit |
Dry-run: merge and validate without writing the output file |
--no-values |
Hide values in the missing-keys report (use with env) |
--percent |
show a message with percent of not exists config in env |
--json |
flush messages of log as JSON |
--color |
colorize text output |
- logs and outputs are flushed on defer.
devenv --config path/to/myconf.toml dev
devenv dev --dont-commit
devenv env prod --no-values[output]
name = ".env" # output file name
type = "dotenv" # dotenv | yaml | toml
[base]
# shared defaults applied to every environment
[dev]
# keys here override [base] for: devenv dev
[prod]
# keys here override [base] for: devenv prodMerge rules:
- Load
[base] - Apply the selected environment's overrides (environment keys win over base)
- Render to the configured output format
- Write to
output.name
flowchart TD
A[CLI Input] --> B[Load config.toml]
B --> C[base layer]
C --> D[environment overrides]
D --> E[merge]
E --> F[render dotenv / yaml / toml]
F --> G[write output file]
devenv prod && export $(cat .env | xargs)Can I define unlimited environments?
Yes — any TOML section that is not [base] or [output] is treated as an environment.
What output formats are supported?
dotenv, yaml, and toml.
Is the output deterministic? Yes. Keys are always sorted alphabetically, so the file is stable across runs.
What happens if a key only exists in [base] and not in the selected environment?
It is included as-is from [base].
git clone https://github.com/arashrasoulzadeh/devenv
go test ./...PRs welcome.
MIT © Arash Rasoulzadeh