Last updated

Environment variable files

No new signups

Looking for Realm documentation? These documentation are for our old developer portal. Realm users should contact their account manager for details of the early access documentation.

Environment variables are set from the local shell (or CI shell) or can be provided from a file.

Environment files take precedence over shell environment variables during developer portal builds.

The benefits of using a file is keeping them centrally organized in source control. The drawback is you should not keep any secrets in the file (or in source control). Environment variable files are only usable with developer portals (not with the API registry).

Your environment files must:

  • be in the root of your project repository
  • start with .env.
  • end with the environment's name (eg. production or development)

Example environment file names:

  • .env.production
  • .env.development
  • .env.austin

Example environment file contents:


Never store credentials or any kind of sensitive data in your environment files.

By default, Redocly will use .env.development for your local development server, and .env.production in our production build.

To determine which environment file is used, set the environment variable named REDOCLY_ACTIVE_ENV to the value of the environment.

The REDOCLY_ACTIVE_ENV should be set by shell (for on-premise or local development) or in Workflows.

Setting environment variables in your shell is operating system-specific (check your corresponding operating system documentation for setting environment variables).

Given this environment variable setting (REDOCLY_ACTIVE_ENV=production-example), Redocly would look for the .env.production-example in your project root.


Restart your development server if you change your environment variables.

All variables in the file are automatically allowed to be used in the client-side developer portal app.