intermediate10 minutesevnx v0.2.1+

evnx migrate

Reference documentation for the evnx migrate command: move secrets from .env files to cloud secret managers and CI/CD platforms.

Prerequisites

evnx migrate — Command Reference

Move secrets from your .env file into cloud secret managers and CI/CD platforms. Supports nine destinations with dry-run previews, key filtering, and prefix transforms.

Feature flag required. The migrate command is not included in the default evnx build. Install with the migrate feature to enable it:

  • cargo install evnx --features migrate
  • Or from source: cargo build --features migrate

Command signature

Bash
evnx migrate [OPTIONS]

Running evnx migrate with no flags opens an interactive menu to pick a source and destination. Every option can also be supplied as a flag for scripted or CI use.


Sources

ValueDescription
env-fileRead secrets from a .env file (default)
environmentRead from the current process environment variables (common system variables are filtered out automatically)

Destinations

ValueAliasesHow evnx helps
github-actionsgithubUploads secrets directly via the GitHub REST API
aws-secrets-managerawsPrints ready-to-run aws secretsmanager CLI commands
dopplerPrints doppler secrets set commands; requires Doppler CLI
infisicalPrints infisical secrets set commands; requires Infisical CLI
gcp-secret-managergcpPrints gcloud secrets create commands
azure-keyvaultazurePrints az keyvault secret set commands
vercelPrints vercel env add commands; requires Vercel CLI
herokuPrints a single bulk heroku config:set command
railwayPrints a railway variables set command; requires Railway CLI

GitHub Actions is the only destination where evnx uploads secrets directly. All other destinations print CLI commands for you to review and run.


Options reference

General options

FlagTypeDefaultDescription
--fromstringSource: env-file or environment. Interactive if omitted.
--source-filepath.envPath to the source .env file (only used when --from env-file)
--tostringDestination slug. Interactive if omitted.
--dry-runboolfalsePreview what would be migrated without uploading or printing commands
--skip-existingboolfalseSilently skip secrets that already exist at the destination
--overwriteboolfalseSilently overwrite secrets that already exist without prompting
--verbose, -vboolfalsePrint diagnostic output during the run

Filtering options

Applied before any secret reaches the destination. Filtering runs in this order: include → exclude → strip prefix → add prefix.

FlagTypeDefaultDescription
--includeglob,...Comma-separated glob patterns. Only keys matching at least one pattern are migrated. Example: "DB_*,AWS_*"
--excludeglob,...Comma-separated glob patterns. Keys matching any pattern are dropped. Example: "*_LOCAL,*_TEST"
--strip-prefixstringRemove a leading prefix from every key before uploading. Example: APP_ turns APP_DB_URL into DB_URL
--add-prefixstringPrepend a prefix to every key before uploading. Example: PROD_ turns DB_URL into PROD_DB_URL

GitHub Actions options

FlagTypeDefaultDescription
--repostringRepository in owner/repo format. Interactive if omitted.
--github-tokenstring$GITHUB_TOKENPersonal Access Token with secrets:write scope. Reads from the environment if not supplied.

AWS Secrets Manager options

FlagTypeDefaultDescription
--secret-namestringSecret name in Secrets Manager, e.g. prod/myapp/config. Interactive if omitted.
--aws-profilestringNamed AWS CLI profile to include in the printed commands

Doppler options

FlagTypeDefaultDescription
--projectstringDoppler project slug. Omit to use the CLI's currently selected project.
--doppler-configstringDoppler config name, e.g. dev, staging, prd

Infisical options

FlagTypeDefaultDescription
--projectstringInfisical project ID
--infisical-envstringInfisical environment name, e.g. dev, staging, prod

Azure Key Vault options

FlagTypeDefaultDescription
--vault-namestringAzure Key Vault name. Interactive if omitted.

Azure Key Vault does not allow underscores in secret names. evnx automatically converts every underscore in a key name to a hyphen — DB_URL becomes DB-URL — and prints a rename log so nothing is lost silently.

Heroku options

FlagTypeDefaultDescription
--heroku-appstringHeroku application name. Interactive if omitted.

Vercel options

FlagTypeDefaultDescription
--vercel-projectstringVercel project ID or name

Railway options

FlagTypeDefaultDescription
--railway-projectstringRailway project ID

Glob pattern syntax

The --include and --exclude flags use a simple glob syntax:

PatternMatches
DB_*Any key starting with DB_
*_SECRETAny key ending with _SECRET
*_KEY_*Any key containing _KEY_
DATABASE_URLExact match only
*Every key

Patterns are case-sensitive. Multiple patterns are comma-separated: --include "DB_*,AWS_*".


Exit codes

CodeMeaning
0Migration completed (or dry-run completed)
1Migration failed — missing files, API errors, user cancelled

See also