Service settings
Environment variables: static values, references to other Services, secret() helper, and database reference variables.
Written By Zoro
Last updated 3 days ago
This page migrates the legacy Environment variables guide into the Services IA. You configure variables on App and Docker Services from the Service settings UI.
Types of values
Static values
Fixed strings that stay the same across Deployments.
Example: STRIPE_SECRET_KEY=sk_test_51HxxxxxxEXAMPLE
Dynamic references
Link a variable to another Service or resource so updates propagate when the target changes. Syntax uses double braces with a service slug (or generated name) and variable:
Example: MONGO_URI={{ databases-7cis-marketing-os1g.MONGO_URI }}
(Replace with names from your workspace.)
secret() helper
Generate random secrets at deploy time:
Format: length, then charset string.
Example: PAYLOAD_SECRET={{ secret(64, "abcdefghijklMNOPQRSTUVWXYZ") }}
Combining values
Join static text and references in one variable, for example:
url=https://{{ databases-7cis-test-2tiu.DFLOW_PUBLIC_DOMAIN }}DATABASE_HOST={{ databases-7cis-marketing-os1g.MONGO_HOST }}:{{ databases-7cis-marketing-os1g.MONGO_PORT }}
Database reference variables
Database Services expose references you can use from App / Docker Services. Private vs public sets differ; use Expose (or equivalent) on the database Service when you intentionally publish public endpoints.
Private (typical)
Public (when exposed)
Use the database Service Generate / Expose flow in the UI to opt in to public references.
Best practices
- Prefer references over hard-coded secrets and hostnames.
- Use
secret()for generated credentials. - Redeploy or restart after changes so processes pick up new values.
- Keep naming consistent across Services.
- Never commit secrets to Git.
Limitations
Environment variables and Volumes for database-type Services are more restricted than for App and Docker Services; follow in-product messages.
Related
- Databases overview and Database credentials and connections for connection fields and reference variable prefixes.
- Git source integrations
- Docker registry integration
- Environment variable issues
- Deployment issues when variable changes require a redeploy but the deploy still fails