envprof
Profile-based environment variable manager

envprof is a CLI tool for managing named environment profiles in YAML or TOML.
It supports layering (inheritance) of profiles and is designed for clarity and shell integration.
Features
- Define multiple environment profiles in one file
- Supports YAML and TOML formats
- Profile inheritance with conflict resolution
- Export profiles to shell using
eval "$(envprof export <profile>)"
- Export profiles to
.env files
Installation
For a quick installation, you can use the provided installation script:
curl -sSL https://raw.githubusercontent.com/idelchi/envprof/refs/heads/dev/install.sh | sh -s -- -d ~/.local/bin
Usage
# list all profiles
envprof list
# list all variables in a profile
envprof list dev
# list a specific variable
envprof list dev DB_URL
# export for shell eval
eval "$(envprof export dev)"
# export profile to a file
envprof export dev .env
The following flags are available:
--file, -f: Specify a file (or list of fallbacks) to load.
Defaults to ENVPROF_FILE or envprof.yaml, envprof.yml, envprof.toml.
--verbose, -v: Enable verbose output to trace inheritance for variables.
Complex types (arrays, maps) are serialized as JSON representations, everything else is stringified.
YAML
dev:
extends:
- staging
env:
HOST: localhost
staging:
extends:
- prod
env:
HOST: staging.example.com
DEBUG: true
prod:
env:
HOST: prod.example.com
PORT: 80
DEBUG: false
TOML
[dev]
extends = ['staging']
[dev.env]
HOST = 'localhost'
[staging]
extends = ['prod']
[staging.env]
DEBUG = true
HOST = 'staging.example.com'
[prod.env]
DEBUG = false
HOST = 'prod.example.com'
PORT = 80
Inheritance Behavior
Inheritance is resolved in order. Later profiles override earlier ones. As an example,
running envprof export dev .env with the previous YAML file produces the following .env file:
# Active profile: "dev"
HOST=localhost
DEBUG=true
PORT=80
Inspecting with envprof list dev -v would show the inheritance chain:
HOST=localhost
DEBUG=true (inherited from "staging")
PORT=80 (inherited from "prod")
Additional commands
Below commands are destructive (reformat the profiles file)
and should just be used to set up the initial file if you care about comments and formatting.
# import values from a dotenv file into a profile (creating it if it doesn't exist),
# with the option whether to keep existing values in case of conflicts or to overwrite them
envprof import dev [--keep] .env
# convert current file to another format
envprof convert [yaml|toml]