Promote environment configuration and secrets from dev to staging, or staging to production. Shows a diff first so nothing surprises you.
# Promote dev config to staging (with diff preview)
nself promote staging
# Promote staging config to production
nself promote prodnself promote <ENV> [FLAGS]nself promote copies environment configuration from one tier to the next in the nSelf environment cascade: dev → staging → prod. Before making any changes it shows a color-coded diff of all values that would be added, changed, or removed so you can review the impact.
The promotion copies non-secret config values automatically. Secrets (values that match the secret pattern defined in your stack config) are flagged in the diff and require explicit confirmation before promotion, or can be excluded entirely with --skip-secrets.
Source and destination are derived from the target environment:
| Command | Source | Destination |
|---|---|---|
nself promote staging | .env.dev | .env.staging |
nself promote prod | .env.staging | .env.prod |
Promote dev configuration to staging.
nself promote stagingExample diff output:
Promoting dev → staging
─────────────────────────────────────────────
+ FEATURE_NEW_ONBOARDING=true (new)
~ HASURA_GRAPHQL_MAX_CONNECTIONS=20 (was: 10)
- LEGACY_PAYMENT_ENDPOINT (removed)
! SMTP_PASSWORD=•••••••• (secret — will prompt)
─────────────────────────────────────────────
4 changes (1 new, 1 changed, 1 removed, 1 secret)
Apply? [y/N]Promote staging configuration to production. Requires a second confirmation for the promotion step, since production changes are irreversible until manually reverted.
nself promote prodExample diff output:
Promoting staging → prod
─────────────────────────────────────────────
+ FEATURE_NEW_ONBOARDING=true (new)
~ HASURA_GRAPHQL_MAX_CONNECTIONS=20 (was: 10)
─────────────────────────────────────────────
2 changes
This promotes to PRODUCTION. Type "yes" to confirm: | Flag | Type | Default | Description |
|---|---|---|---|
--skip-secrets | bool | false | Exclude secret values from the promotion (copy only non-secret config) |
--only | string | — | Comma-separated list of env var names to promote (promotes only those keys) |
--skip | string | — | Comma-separated list of env var names to exclude from promotion |
--yes | bool | false | Skip interactive confirmation (for CI pipelines; still requires --confirm-prod for production) |
--confirm-prod | bool | false | Skip the extra production confirmation (use only in automated deployments with explicit approval upstream) |
--dry-run | bool | false | Show the diff without applying any changes |
--json | bool | false | Output the diff as JSON (useful for CI audit logs) |
nself promote staging --dry-runnself promote staging --only FEATURE_NEW_ONBOARDING,HASURA_GRAPHQL_MAX_CONNECTIONSnself promote prod --skip-secrets --yes --confirm-prod# After staging tests pass
nself promote prod \
--skip-secrets \
--yes \
--confirm-prod \
--json > promote-audit.jsonnself promote staging --yes && nself restart --env stagingNSELF_PROMOTE_CONFIRM — set to yes to skip interactive confirmations (equivalent to --yes --confirm-prod). For automated pipelines only.0 — promotion applied successfully1 — promotion cancelled by user or error2 — invalid arguments or unknown target environment3 — source environment has unresolved conflicts