wtree Cloud

Environment variables

Define variables at project, environment or service level and reference them, or external secrets, from any service.

You can declare a variable at three levels and reference higher levels from a service.

LevelScopeReference in a service
Project (shared)Every service in the project${{project.NAME}}
EnvironmentEvery service in one environment${{environment.NAME}}
ServiceOne service. Overrides shared values.${{NAME}}
Environment variables panel

wtree Cloud replaces each reference with the value when it deploys. Multiline values go in double quotes.

Share a variable across services

Define it once in the project's Variables tab, under Project variables.

DATABASE_URL=postgresql://postgres:postgres@database:5432/postgres

Reference it in each service's Settings › Environment variables.

DATABASE_URL=${{project.DATABASE_URL}}

Per-environment values

Define the values in the Variables tab, under Environment variables, for example in a staging environment.

DATABASE_PASSWORD=staging_secret_password
API_KEY=staging_api_key_12345

Reference them in services of that environment.

DATABASE_URL=postgresql://postgres:${{environment.DATABASE_PASSWORD}}@staging-db:5432/postgres
EXTERNAL_API_KEY=${{environment.API_KEY}}

Service variables

Service variables can build on each other.

DATABASE_USER=service_user
DATABASE_PASSWORD=service_password
DATABASE_URL=postgresql://${{DATABASE_USER}}:${{DATABASE_PASSWORD}}@service-database:5432/postgres

Services in preview deployments also get W3PANEL_DEPLOY_URL, the deployment's URL.

APP_URL=https://${{W3PANEL_DEPLOY_URL}}

External secrets

Reference a secret from HashiCorp Vault or OpenBao, Infisical, AWS Secrets Manager, Doppler or Azure Key Vault.

DB_PASSWORD=${{vault.prod-vault.myapp/prod:DB_PASSWORD}}

wtree Cloud fetches the value at deploy time and never stores it. See Secrets for setup, formats and access control.

Tips

  • Use shared variables for values that repeat across services.
  • Use descriptive names and note what each one is for.

On this page