Skip to content
Atlas Platform
GitHubDiscordYouTube

Environment Variables

Environment variables are composed of key-value pairs set externally from your source code. They can influence the behavior of the web application, providing a way to adjust its configuration without changing the codebase. Each value can be modified based on the specific Atlas environment.

Modifications to environment variables do not retroactively affect past builds. They are effective only for subsequent builds.

Managing environment variables

To add new variables visit the Atlas Environment Details page and click the Go to variables link of the Variables card. Visit env vars screen

Enter the keys and values for your Environment Variables and click Save to confirm. To add more environment variables, simply click on Add environment variable and repeat the previous steps. Add new variable

To confirm all changes, hit the Save all variables button. Save all variables

To edit an existing variable, click the three-dot menu on the right and select Edit. Edit variable

You can remove a variable by selecting Delete from the three-dot menu. Delete variable

Limitations

Reserved variables and namespaces

Atlas reserves some environment variables and prefixes. You cannot use these for your own variables:

  • PORT
  • WPE_ prefix
  • ATLAS_METADATA prefix

If you try to use these reserved keys, Atlas will display a warning and won’t save the variable.

Allowed format of keys

Environment variables’ keys on Atlas must match the following regex:

[a-zA-Z_]{1,}[a-zA-Z0-9_]*.

System environment variables

Atlas automatically generates a collection of environment variables to provide users with metadata about their environments. This includes variables such as the Build ID or a flag that signifies whether the environment in question is a preview or production environment. You can find the complete list of system environment variables in the table below:

Environment VariableDescriptionExample
ATLAS_METADATA_SOURCESource control providergithub
ATLAS_METADATA_REPOSITORYGit repository name and ownersome-user/repo-name
ATLAS_METADATA_APP_NAME Name of the Atlas applicationmy-app
ATLAS_METADATA_ENV_NAMEName of the Atlas environmentmain-env
ATLAS_METADATA_COMMIT_SHACommit identifier for the current build4e6f58b
ATLAS_METADATA_ENV_BRANCHGit branch used for the current buildmain
ATLAS_METADATA_PREVIEW_ENVFlag that indicates if the environment is a ‘preview’ typetrue
ATLAS_METADATA_ENV_IDUnique identifier for the Atlas environment026bbe63-8043-1c3e-00e5-d95c5a12aa32
ATLAS_METADATA_BUILD_IDIdentifier for the latest build5f42ce7c-b894-887d-1b9e-69d2429acbdd
ATLAS_METADATA_CLEAN_BUILDIndicates if the build is a ‘clean’ buildfalse