Skip to main content

Environment Scopes

Shield supports three scopes for managing secrets across environments.

Available Scopes

ScopeDescriptionExample
developmentLocal development (default)Dev API keys
stagingStaging/preview environmentsStaging database
productionProduction environmentLive credentials

Setting Scoped Secrets

# Development (default)
dotset secrets set API_KEY "dev-key"

# Staging
dotset secrets set API_KEY "staging-key" --scope staging

# Production
dotset secrets set API_KEY "prod-key" --scope production

Running with a Scope

# Uses development secrets (default)
dotset run -- npm start

# Uses staging secrets
dotset run --scope staging -- npm start

# Uses production secrets
dotset run --scope production -- npm start

Listing by Scope

dotset secrets list --scope production

Use Cases

Local Development

dotset secrets set DATABASE_URL "postgres://localhost/dev"
dotset run -- npm start

CI/CD Staging

dotset run --scope staging -- npm test

Production Deployment

dotset run --scope production -- node server.js
Keep your production secrets separate. Use different encryption keys for each environment in high-security setups.