Skip to main content

Overview

The applad env command manages environment variables and .env.example generation. Every ${VAR} reference in your yaml files is tracked by Applad. .env.example files are auto-generated and scoped to each level of the org/project hierarchy.

Commands

Generate .env.example

Scans all yaml files in the active project, extracts every ${VAR} reference, and generates a .env.example file annotated with which config file uses each variable, what format it expects, and whether it should be treated as a secret. Run this after adding any new ${VAR} reference to any yaml file.
applad env generate
Scoped generation:
# Generate for all projects in an org
applad env generate --org acme-corp

# Generate for all projects across the instance
applad env generate --all

# Generate only for a specific environment
applad env generate --env production
What’s included in .env.example:
  • Variable names
  • Which config files reference each variable
  • Expected format/type
  • Whether it’s a secret
  • Example values (when appropriate)

Validate Environment Variables

Checks that every ${VAR} reference in the config tree has a corresponding value set in the environment. Fails with a clear error message naming the missing variable and the exact config file that references it. applad up runs this automatically on startup — use this to check manually before a deploy.
applad env validate
Environment-specific validation:
# Validate only variables needed for production
applad env validate --env production
What it checks:
  • All ${VAR} references have corresponding values
  • Reports missing variables with file locations
  • Validates environment-specific variables

Show Environment Diff

Shows the difference between the variables referenced in your config files and what’s actually set in your .env. Highlights variables that are referenced but missing, and variables that are set in .env but not referenced anywhere in the config (potential dead config).
applad env diff
Output shows:
  • Variables referenced but not set (missing)
  • Variables set but not referenced (unused)
  • Environment-specific differences

List Environment Variables

Lists all environment variable keys currently set for the active project. Values are never shown — keys only. This is intentional: secrets should never appear in terminal output.
applad env list
List for specific project:
applad env list --project <id>

Set Environment Variable

Sets an environment variable for the running instance. Takes effect immediately without requiring a restart.
applad env set KEY=value
Examples:
applad env set DATABASE_URL=postgresql://localhost/mydb
applad env set API_KEY=sk_live_abc123
applad env set NODE_ENV=production

Unset Environment Variable

Removes an environment variable from the running instance.
applad env unset KEY
Example:
applad env unset DEPRECATED_API_KEY

Pull Environment Variables

Pulls the environment variables from the running instance down to a local .env file. Values are included. Warning: Use with care — the resulting .env file contains real secrets and should never be committed to version control. Applad’s .gitignore excludes .env files automatically.
applad env pull

Push Environment Variables

Pushes your local .env file to the running instance, setting all variables in one operation. Variables not present in the .env file are left unchanged on the instance.
applad env push
What happens:
  • All variables in .env are set on the running instance
  • Existing variables not in .env remain unchanged
  • Takes effect immediately without restart

Workflow Examples

Setting up a new environment

# 1. Generate .env.example for the environment
applad env generate --env production

# 2. Copy to .env and fill in real values
cp .env.example .env

# 3. Edit .env with real credentials
# (use your preferred editor)

# 4. Validate before deploying
applad env validate --env production

# 5. Push to instance
applad env push

Adding a new variable to config

# 1. Add ${NEW_VAR} to your yaml file

# 2. Regenerate .env.example
applad env generate

# 3. Add the value to your .env
echo "NEW_VAR=value" >> .env

# 4. Validate
applad env validate

# 5. Push to instance
applad env push

Auditing environment variables

# Check what's set
applad env list

# Check for missing or unused variables
applad env diff

# Validate all references are satisfied
applad env validate

Best Practices

  1. Never commit .env files: Keep .env in .gitignore (Applad does this automatically)
  2. Always commit .env.example: Check .env.example into version control to document required variables
  3. Regenerate after config changes: Run applad env generate after adding ${VAR} references
  4. Validate before deployment: Run applad env validate before applad up or applad deploy
  5. Use environment-specific validation: Test with --env production before deploying to production
  6. Document variable purposes: Use .env.example to document what each variable is for

Security Notes

  • Variable values are never logged or displayed in terminal output
  • Use applad security secrets set for highly sensitive values that need encryption at rest
  • Environment variables are encrypted in transit when using applad env push/pull
  • All env changes are recorded in the audit trail with SSH key attribution

Build docs developers (and LLMs) love