DocsConfiguration

Environment Variables

Store secrets and configuration safely.

Configuration 3 min read

Environment variables are encrypted at rest and injected into your service when it starts. Changes apply the next time the service starts: restart or redeploy it to pick up new values. Secret values are masked in build and runtime logs.

bash
DISCORD_TOKEN=************
DATABASE_URL=************
NODE_ENV=production

Naming conventions

  • Use uppercase with underscores: STRIPE_SECRET_KEY, not stripeKey.
  • Prefix related values so they are easy to find: DB_HOST, DB_USER, DB_PASSWORD.
  • Keep a .env.example file in your repository listing every variable name, without values.

Reserved variables

VariableValue
PORTThe port your web server must listen on.
DIGITALY_REGIONThe region running your service, e.g. lyon.
DIGITALY_DEPLOYMENT_IDUnique identifier of the current deployment.
Never expose secret credentials in your source code or in your logs.
Was this article helpful?