Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
E

envelope

> 数据库
Open source

An environment variables cli tool backed by SQLite

657 stars0 likes1 views
WebsiteGitHub

About

An environment variables cli tool backed by SQLite

envelope

envelope is a modern environment variables manager.

…

Installation

Brew

You can install envelope from homebrew-core:

bash
$ brew install envelope

Binary

You can download the envelope binary in the latest release and copy the binary to a folder in your $PATH

Cargo

You can install envelope with cargo, make sure that your ~/.cargo folder is in your $PATH

bash
$ cargo install --git https://github.com/mattrighetti/envelope
$ envelope --version
envelope 0.3.11

Arch

There is an aur package that packages the binary, called envelope-bin:

bash
yay -S envelope-bin

Building from Source

envelope is written in Rust. You'll need the Rust compiler.

bash
$ git clone https://github.com/mattrighetti/envelope
$ cd envelope
$ cargo build --release
$ ./target/release/envelope --version
envelope 0.7.1

Usage

Init

Initialize envelope in your current directory. This creates a .envelope database file.

bash
$ envelope init

[!NOTE] You must run envelope init before using any other commands. The .envelope file should be added to your .gitignore to avoid committing sensitive environment variables.

Pretty print

Pipe .env files to envelope to get a pretty format representation of the file

…

Import

Import from .env file

bash
$ envelope import dev .env
$ envelope list dev
API_KEY=your_api_key_here
AWS_ACCESS_KEY_ID=your_access_key_id
DATABASE_URL=postgres://user:password@localhost:5432/mydb
DEBUG_MODE=true
SECRET_KEY=mysecretkey123
SMTP_HOST=smtp.example.com

It's also possible to import directly from stdin

bash
$ cat .env | envelope import prod

List

List all saved environments:

bash
$ envelope list
dev
staging
prod

List environment variables of a particular environment:

bash
$ envelope list dev
API_KEY=your_api_key
DATABASE_URL=postgres://user:password@localhost:5432/mydb
DEBUG_MODE=true
SECRET_KEY=mysecretkey123
SMTP_HOST=smtp.example.com

Pretty print with a table format:

bash
$ envelope list dev --pretty-print
+-------------+----------------------------------------------+-------+
| ENVIRONMENT | VARIABLE                                     | VALUE |
+-------------+----------------------------------------------+-------+
| dev         | DATABASE_URL                                 | pos.. |
+-------------+----------------------------------------------+-------+
| dev         | SECRET_KEY                                   | mys.. |
+-------------+----------------------------------------------+-------+
...

Truncate long values in pretty print mode:

bash
$ envelope list dev --pretty-print --truncate

Sorting Options

You can specify the sorting order using the --sort option:

  • key or k: Sort by key in ascending order
  • value or v: Sort by value in ascending order
  • date or d: Sort by creation date in ascending order
  • kd: Sort by key in descending order
  • vd: Sort by value in descending order
  • dd: Sort by creation date in descending order (default)

Example:

bash
$ envelope list dev --sort kd
SMTP_HOST=smtp.example.com
SECRET_KEY=mysecretkey123
DEBUG_MODE=true
DATABASE_URL=postgres://user:password@localhost:5432/mydb
API_KEY=your_api_key

Add

Add environment variables to an environment:

bash
$ envelope add dev api_key sk_test_123456789
$ envelope list dev
API_KEY=sk_test_123456789

Variable names are automatically uppercased:

bash
$ envelope add dev database_url postgres://localhost/mydb
$ envelope list dev
DATABASE_URL=postgres://localhost/mydb

Read value from stdin for sensitive data:

bash
$ envelope add dev secret_token --stdin
Enter value for env secret_token:
my-super-secret-token

Add a variable with an empty value:

bash
$ envelope add dev optional_var
$ envelope list dev
OPTIONAL_VAR=

Delete

Delete a specific variable from an environment (soft delete — can be reverted):

bash
$ envelope delete --env dev --key API_KEY
$ envelope list dev
# API_KEY will no longer appear

Delete a variable across all environments:

bash
$ envelope delete --key DEBUG_MODE
# Removes DEBUG_MODE from all environments where it exists

Delete an entire environment:

bash
$ envelope delete --env dev
$ envelope list
# dev will no longer appear

[!NOTE] Envelope always soft deletes environment variables. They are never actually removed from the database, which allows you to view the history and revert changes. For a hard delete that permanently removes data, use the drop command.

Drop

Drops (hard deletes) an environment and permanently removes all its variables from the database:

bash
$ envelope drop dev
$ envelope list
# dev is permanently deleted, including all its history

[!WARNING] Unlike delete, the drop command permanently removes all data. This cannot be undone and you will not be able to view history or revert changes.

Duplicate

Create a copy of an existing environment:

bash
$ envelope add dev api_key sk_dev_12345
$ envelope add dev database_url postgres://localhost/devdb
$ envelope duplicate dev staging
$ envelope list staging
API_KEY=sk_dev_12345
DATABASE_URL=postgres://localhost/devdb

This is useful for:

  • Creating a new environment based on an existing one
  • Copying production settings to staging for testing
  • Creating backups before making changes

Example workflow:

bash
# Create a backup before experimenting
$ envelope duplicate prod prod-backup

# Make changes to prod
$ envelope add prod api_key sk_new_key

# If something goes wrong, restore from backup
$ envelope duplicate prod-backup prod

Edit

Open your $EDITOR to interactively edit environment variables:

bash
$ envelope edit dev

This opens your default editor with all variables in the format:

API_KEY=your_api_key
DATABASE_URL=postgres://localhost/mydb
DEBUG_MODE=true

Editing tips:

  • Modify values by changing the text after =
  • Delete a variable by commenting it out with #:
    #API_KEY=your_api_key
  • Add new variables by adding new lines:
    NEW_VAR=new_value

When you save and close the editor, envelope will:

  • Update all modified values
  • Delete all commented variables (soft delete)
  • Add all new variables

Check

Check which environment(s) are currently exported in your shell:

bash
$ export $(envelope list dev)
$ envelope check
dev

Check works by comparing your current shell's environment variables against all stored environments. It will show all environments whose variables exactly match what's currently exported.

Multiple environments can match if they share the same variables:

bash
$ envelope add shared-config api_key sk_12345
$ envelope duplicate shared-config also-shared
$ export $(envelope list shared-config)
$ envelope check
shared-config
also-shared

If no environment matches completely, nothing is returned:

bash
$ envelope check
# No output means no environment is fully active

Lock

Encrypt the envelope database. You will be prompted for a password and a confirmation.

bash
$ envelope lock
Password: ********
Confirm password: ********
database locked successfully

[!NOTE]

When the database is locked, you'll be prompted to unlock it when needed. You can still run commands on a locked envelope.

Unlock

Decrypt the envelope database with the password you set when locking it.

bash
$ envelope unlock
Password: ********
database unlocked successfully

Diff

Compare two environments to see their differences:

diff
$ envelope add local db_connection http://localhost:3030
$ envelope add local dev true
$ envelope add prod db_connection https://proddb.com
$ envelope add prod db_user pg
$ envelope add prod db_pwd somepwd
$ envelope diff local prod
# DB_CONNECTION=http://localhost:3030 -> https://proddb.com
- DB_PWD=somepwd
- DB_USER=pg
+ DEV=true

The output shows:

  • Gray # lines: Variables present in both environments but with different values
    • First value is from the source environment (local)
    • Second value is from the target environment (prod)
  • Red - lines: Variables only in the target environment (prod)
  • Green + lines: Variables only in the source environment (local)

Use cases:

bash
# Compare development and production configs
$ envelope diff dev prod

# Verify staging matches production
$ envelope diff staging prod

# Check what changed before deploying
$ envelope diff current-prod new-prod

Revert

Revert a variable to its previous value. Each call to revert moves one step back in history:

bash
$ envelope add local db_connection http://localhost:3030
$ envelope add local db_connection http://localhost:2222
$ envelope add local db_connection http://localhost:3333
$ envelope list local
DB_CONNECTION=http://localhost:3333

$ envelope revert local db_connection
$ envelope list local
DB_CONNECTION=http://localhost:2222

$ envelope revert local db_connection
$ envelope list local
DB_CONNECTION=http://localhost:3030

Practical example:

bash
# Accidentally set wrong API key
$ envelope add prod api_key sk_wrong_key_12345
# Oops! Revert to the previous value
$ envelope revert prod api_key
# Back to the correct key

[!NOTE] Revert works because envelope keeps a complete history of all changes. You can revert multiple times to go back through the entire history. Use envelope history to see all historical values before reverting.

Run

Run a command with environment variables from a specific environment automatically injected. This avoids the need to manually export variables into your shell.

bash
$ envelope run dev -- cargo run

You can run any command and its arguments. The -- separator is optional but recommended when your command includes its own flags.

If you wish to clear the inherited envs from the parent process, you can use the --isolated flag and that will make sure only the selected env variables are injected in the subprocess.

bash
$ envelope add prod ENVIRONMENT=prod
$ envelope run prod env
PATH=...
HOME=/Users/matt
SHELL=/bin/zsh
ENVIRONMENT=prod

$ envelope run prod --isolated env
# only PATH is inherited from parent
PATH=...
ENVIRONMENT=prod

Use cases:

  • Run scripts without polluting your current shell environment.
  • Quickly test different environments against the same command.
  • Use in CI/CD pipelines to wrap execution steps.

History

View the complete history of a variable, including deleted values:

bash
$ envelope add local db_connection http://localhost:3030
$ envelope add local db_connection http://localhost:2222
$ envelope add local db_connection http://localhost:3333
$ envelope history local db_connection
2025-01-01 00:00:00 DB_CONNECTION=http://localhost:3030
2025-02-01 00:00:00 DB_CONNECTION=http://localhost:2222
2025-03-01 00:00:00 DB_CONNECTION=http://localhost:3333

View deleted variables:

bash
$ envelope add dev api_key sk_old_key
$ envelope add dev api_key sk_new_key
$ envelope delete --env dev --key api_key
$ envelope history dev api_key
2025-01-01 10:00:00 API_KEY=sk_old_key
2025-01-01 11:00:00 API_KEY=sk_new_key

Use cases:

  • Audit when and how a variable changed
  • Find the previous value before a mistake
  • Track configuration changes over time
  • Recover deleted variables by seeing their last value

Common Workflows

Starting a New Project

bash
# Initialize envelope in your project
$ cd my-project
$ envelope init

# Import existing .env files
$ envelope import dev .env.development
$ envelope import prod .env.production

# Add .envelope to .gitignore
$ echo ".envelope" >> .gitignore

Daily Development

bash
# Switch between environments
$ export $(envelope list de

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Rustclienvironment-variablesrustsqlite

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category数据库
PricingOpen source

> Related tools

P
PostgreSQL
功能强大的开源关系型数据库
R
Redis
内存数据结构存储,常用作缓存与队列
M
MySQL
广泛使用的开源关系型数据库