dFlow LogodFlow
GuidesFundamentalsEnvironment Variables

Environment Variables

dFlow allows you to create and manage environment variables for your services.

Supported Types

Static values

Set fixed values that remain the same across deployments.

For example: STRIPE_SECRET_KEY=sk_test_51HxxxxxxEXAMPLE

Dynamic reference variables

Dynamic reference variables allow you to link an environment variable directly to values from other services or resources, ensuring that the value updates automatically if the linked service changes.

For example: MONGO_URI={{ databases-7cis-marketing-os1g.MONGO_URI }}

Functions

Use secret() to create random secrets on the fly.

Format

  • length – Number of characters (e.g., 32, 64)
  • charset – Allowed characters (e.g., "abcABC123", "aA1!")

For example: PAYLOAD-SECRET={{ secret(64, "abcdefghijklMNOPQRSTUVWXYZ") }}

Combine multiple reference values

You can create a single environment variable by combining static values, dynamic references, or secrets. This helps build connection strings or keys without hardcoding sensitive data.

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 Connection References

The following reference variables are available for all database services.

Private reference values

DatabaseReference Variables
MongoDBMONGO_URI, MONGO_HOST, MONGO_PORT, MONGO_USERNAME, MONGO_PASSWORD, MONGO_NAME
PostgreSQLPOSTGRES_URI, POSTGRES_HOST, POSTGRES_PORT, POSTGRES_USERNAME, POSTGRES_PASSWORD, POSTGRES_NAME
MySQLMYSQL_URI, MYSQL_HOST, MYSQL_PORT, MYSQL_USERNAME, MYSQL_PASSWORD, MYSQL_NAME
MariaDBMARIA_URI, MARIA_HOST, MARIA_PORT, MARIA_USERNAME, MARIA_PASSWORD, MARIA_NAME
RedisREDIS_URI, REDIS_HOST, REDIS_PORT, REDIS_USERNAME, REDIS_PASSWORD, REDIS_NAME

Public reference values

DatabaseReference Variables
MongoDBMONGO_PUBLIC_URL, MONGO_PUBLIC_HOST, MONGO_PUBLIC_PORT
PostgreSQLPOSTGRES_PUBLIC_URL, POSTGRES_PUBLIC_HOST, POSTGRES_PUBLIC_PORT
MySQLMYSQL_PUBLIC_URL, MYSQL_PUBLIC_HOST, MYSQL_PUBLIC_PORT
MariaDBMARIA_PUBLIC_URL, MARIA_PUBLIC_HOST, MARIA_PUBLIC_PORT
RedisREDIS_PUBLIC_URL, REDIS_PUBLIC_HOST, REDIS_PUBLIC_PORT

How to Expose

To get these variables, go to the Generate tab and click Expose on the database service you want to make public.

These variables can be referenced dynamically in your configuration using the syntax
{{ service-name.VARIABLE_NAME }}. For example:

  • {{ databases-7cis-marketing-os1g.MONGO_HOST }}:{{ databases-7cis-marketing-os1g.MONGO_PORT }}

Best Practices

  • Prefer reference variables – avoid hardcoding secrets or URLs in configurations.
  • Use secret() for secure random values – generate strong, unpredictable secrets.
  • Redeploy or restart after changes – ensure updated variables take effect.
  • Maintain consistent naming – make variable references easy to understand and manage.
  • Keep secrets out of code and VCS – never commit sensitive values to version control.

Environment Variable Limitations

Currently, environment variables can only be configured for services of type Docker and App. Adding new variables for database services is not supported.

On this page

Edit on GitHub