Overview
Configure Conductor with environment variables for runtime configuration and secrets for sensitive data. Learn the difference between vars, secrets, and bindings.Types of Configuration
1. Variables (vars)
Non-sensitive configuration values stored inwrangler.toml.
- Environment names
- Feature flags
- Public configuration
- Default values
- API keys
- Passwords
- Tokens
- Private keys
2. Secrets
Sensitive values stored encrypted in Cloudflare.- API keys
- Database passwords
- OAuth tokens
- Signing secrets
- Private keys
3. Bindings
References to Cloudflare resources (D1, KV, R2, etc).Accessing Variables
In Worker Code
In Ensemble Files
Use${env.VARIABLE_NAME} syntax:
Environment-Specific Configuration
Multiple Environments
Environment-Specific Secrets
Deploy to Environment
Local Development
.dev.vars File
Create.dev.vars for local secrets (DO NOT COMMIT):
.gitignore
Access in Local Development
Common Variables
AI Provider Keys
Database Credentials
API Keys
Webhook Secrets
Variable Naming
Conventions
Reserved Names
Avoid these (used by Cloudflare):CF_*- CloudFlare internalWORKER_*- Worker runtime- Any binding names (DB, AI, CACHE, etc.)
Type Safety
Environment Interface
Validation
Check Variables
List Current Variables
Rotation
Secret Rotation
Best Practices
- Never commit secrets - Use .gitignore for .dev.vars
- Use secrets for sensitive data - Not vars in wrangler.toml
- Validate required variables - Check on worker start
- Use environment-specific values - Different keys for dev/prod
- Rotate secrets regularly - Update API keys periodically
- Document variables - Add comments in wrangler.toml
- Use type-safe interfaces - Define Env type
- Principle of least privilege - Only grant necessary access
- Monitor secret access - Track usage in logs
- Backup secrets - Store in secure password manager

