| Crates.io | psenv |
| lib.rs | psenv |
| version | 0.6.0 |
| created_at | 2025-10-29 04:39:34.854103+00 |
| updated_at | 2025-12-09 23:49:19.567982+00 |
| description | A CLI tool to fetch secrets from AWS Parameter Store and generate .env files |
| homepage | https://github.com/theowenyoung/studio/tree/main/rust-packages/psenv |
| repository | https://github.com/theowenyoung/studio |
| max_upload_size | |
| id | 1906058 |
| size | 109,829 |
A Rust CLI tool that fetches secrets from AWS Parameter Store and generates .env files.
.env filesFrom the project directory:
cargo build --release
The binary will be available at target/release/psenv.
psenv --template .env.example --prefix "/studio-dev/" --output .env
--template / -t: Template file path (e.g., .env.example)--prefix / -p: Parameter Store prefix (must start with /, e.g., /studio-dev/)--output / -o: Output file (default: .env)--strategy / -s: Processing strategy (default: overwrite)
overwrite: Completely overwrite the file with only the fetched valuesupdate: Update existing values and add new ones while preserving file formaterror: Error if output file exists--ignore-keys / -i: Skip these keys (comma-separated, e.g., DB_HOST,DEBUG)--require-all: All keys must exist in Parameter Store, otherwise error (default: true)--region / -r: AWS region--profile: AWS profile--dry-run: Preview mode - show what would be written without creating files--quiet / -q: Quiet mode--verbose / -v: Verbose logging--show-secrets: Show secrets in plaintext (default: mask sensitive values)--ignore-keysprefix + key values from AWS Parameter Store--require-all is used)--strategy=error)prefix + key (prefix is automatically removed when writing to .env)
/studio-dev/DB_HOST → .env contains DB_HOST=value--ignore-keys are not fetched from Parameter Store--require-all is used, ignored keys are not checkedpassword, secret, key, token, etc.) are masked in dry-run output. Use --show-secrets to display them in plaintext.psenv -t .env.example -p "/myapp/prod/"
psenv -t .env.example -p "/myapp/prod/" --dry-run
psenv -t .env.example -p "/myapp/prod/" -s overwrite
psenv -t .env.example -p "/myapp/prod/" -i "LOCAL_DEBUG,DEV_MODE"
psenv -t .env.example -p "/myapp/prod/" --profile production --region us-west-2
psenv -t .env.example -p "/myapp/prod/" --dry-run --show-secrets
The template file should contain environment variable declarations:
# Database configuration
DB_HOST=localhost
DB_PORT=5432
DB_NAME=
# API Keys
API_KEY=
SECRET_KEY=
# Optional settings
DEBUG=false
Both uncommented and commented variable declarations are parsed. Comments and empty lines are ignored.
By default, psenv automatically detects and masks sensitive environment variables in dry-run output:
# Default behavior (secrets are masked)
psenv -t .env.example -p "/myapp/prod/" --dry-run
Output example:
API_KEY=****** (24 chars, hidden)
DATABASE_PASSWORD=****** (23 chars, hidden)
DEBUG=false
JWT_SECRET=****** (32 chars, hidden)
PORT=3000
# Show secrets in plaintext
psenv -t .env.example -p "/myapp/prod/" --dry-run --show-secrets
Output example:
API_KEY=sk_live_1234567890abcdef
DATABASE_PASSWORD=super_secret_db_pass123
DEBUG=false
JWT_SECRET=jwt_super_secret_key_for_signing
PORT=3000
The tool automatically detects keys containing these keywords (case-insensitive):
password, passwd, pwdsecret, key, tokenauth, credential, credprivate, secure, salthash, signature, cert, certificate