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/main/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.
YAML
base:
env:
DB_HOST: localhost
DB_PORT: "5432"
dev:
extends: [base]
env:
DB_NAME: devdb
DEBUG: "true"
TOML
[base.env]
DB_HOST = "localhost"
DB_PORT = "5432"
[dev]
extends = ["base"]
[dev.env]
DB_NAME = "devdb"
DEBUG = "true"
Inheritance Behavior
Inheritance is resolved in order. Later profiles override earlier ones. For example:
staging:
extends:
- base
- common
env:
DEBUG: "false"
Results in:
base applied
- then
common (overrides base on conflict)
- then
staging (final override)
Below commands are destructive (remove comments, order, newlines, etc)
and should just be used to set up the initial file.
# convert current file to another format
envprof convert [yaml|toml]
# import values from a dotenv file into a profile
envprof import dev .env