LogoLogo
  • Welcome to Release
  • Getting started
    • Quickstart
    • Create an account
    • Prepare to use Release
    • Create an application
      • Create custom application
      • Create from template
      • Servers vs runnables
    • Create an environment
  • Guides and examples
    • Domains and DNS
      • Manage domains
      • DNS and nameservers
        • Configure GoDaddy
        • Configure Cloudflare
        • Configure Namecheap
        • Other DNS hosts
      • Routing traffic
    • Example applications
      • Full stack voting app
      • Flask and RDS counter app
      • Static site with Gatsby
      • Golang with Postgres and Nginx
      • WordPress with MySQL
      • Spring and PostgreSQL
      • Terraform and Flask
      • OpenTelemetry demo
      • Load balancer with hostname
      • Static JavaScript service
      • SSH bastion access to services
      • ngrok and OAuth for private tunnels
      • Using OAuth Proxy
      • Hybrid Docker and static site
      • App Imports: Connecting two applications
      • Example library
    • Running instances
      • Cron jobs
      • Jobs
      • Using Helm charts
      • Using terminal
      • Viewing logs
      • Troubleshooting
        • ImagePullBackoff error
        • CrashLoopBackoff error
        • Exit codes
        • OOM: out of memory
    • Advanced guides
      • Containers guide
      • Application guide
      • Kubernetes guide
      • Create a cluster
      • Upgrade a cluster
      • Managing node groups
      • Patch node groups
      • Hostnames and rules
      • Serve traffic on multiple ports
      • Configure access to your K8s cluster
      • Designing for multiple environments
      • Microservices architecture
      • Monitoring your clusters
      • Performance tuning
      • Visibility and monitoring
      • Working with data
        • Container-based data
        • Seeding and migration
        • Cloud-provided data
        • Golden images
        • Third party
      • Pausing Instant Datasets
        • Application pausing schedules
        • Pause/resume environments
      • Infrastructure as code
        • Terraform
  • Reference documentation
    • Account settings
      • Account info
      • Managing users
      • Build settings
        • Build arguments
        • Build SSH keys
      • Add integrations
      • View clusters and cloud integrations
      • Add datasets
      • Environment handles
    • Workflows in Release
      • Stages of workflows
      • Serial deployments
      • Parallel deployments
      • Rolling deployments
      • Rainbow deployments
    • Networking
      • Network architecture (AWS)
      • Network architecture (GCP)
      • Ingresses
      • IP addresses
      • Cloud-provided services
      • Third-party services
    • Release environment versioning
    • Application settings
      • Application Template
        • Schema definition
      • Default environment variables
      • GitHub
      • Pull requests
      • GitOps
      • Just-in-time file mounts
      • Primary App Link
      • Create application FAQ
      • App-level build arguments
      • Parameters
      • Workspaces
    • End-to-end testing
    • Environment settings
      • Environment configuration
      • Environment variables
        • Environment variable mappings
        • Secrets vaults
        • Using Secrets with GitOps
        • Kubernetes Secrets as environment variables
        • Managing legacy Release Secrets
    • Environment expiration
    • Environment presets
    • Instant datasets on AWS
    • Instant datasets on GCP
    • Instant dataset tasks
      • Tonic Cloud
      • Tonic On-Premise
    • Cloud resources
    • Static service deployment
    • Helm
      • Getting started
      • Version-controlled Helm charts
      • Open-source charts
      • Building Docker images
      • Ingress and networking
      • Configuration
    • GitOps
    • The .release.yaml file
    • Docker Compose conversion support
    • Reference examples
      • Adding and removing services
      • Managing service resources
      • Adding database containers to the Application Template
      • Stock Off-The-Shelf Examples
    • Release API
      • Account Authentication
      • Environments API
        • Create
        • Get
        • Setup
        • Patch
      • User Authentication
      • Environment Presets API
        • Get Environment Preset List
        • Get Environment Preset
        • Put Environment Preset
  • Background concepts
    • How Release works
  • Frequently asked questions
    • Release FAQ
    • AWS FAQ
    • Docker FAQ
    • JavaScript FAQ
  • Integrations
    • Integrations overview
      • Artifactory integration
      • Cloud integrations (AWS)
        • AWS guides
        • Grant access to AWS resources
        • AWS how to increase EIP quota
        • Control your EKS fleet with systems manager
        • Managing STS access
        • AWS Permissions Boundaries
        • Private ECR Repositories
        • Using an Existing AWS VPC
        • Using an Existing EKS Cluster
      • Docker Hub integration
      • LaunchDarkly integration
      • Private registries
      • Slack integration
      • Cloud integrations (GCP)
        • GCP Permissions Boundary
      • Datadog Agent
      • Doppler Secrets Manager
      • AWS Secrets Management
    • Source control integrations
      • GitHub
        • Pull request comments
        • Pull request labels
        • GitHub deployments
        • GitHub statuses
        • Remove GitHub integration
      • Bitbucket
      • GitLab
    • Monitoring and logging add-ons
      • Datadog
      • New Relic
      • ELK (Elasticsearch, Logstash, and Kibana)
  • Release Delivery
    • Create new customer integration
    • Delivery guide
    • Release to customer account access controls
    • Delivery FAQs
  • Release Instant Datasets
    • Introduction
    • Quickstart
    • Security
      • AWS Instant Dataset security
    • FAQ
    • API
  • CLI
    • Getting started
    • Installation
    • Configuration
    • CLI usage example
    • Remote development environments
    • Command reference
      • release accounts
        • release accounts list
        • release accounts select
      • release ai
        • release ai chat
        • release ai config-delete
        • release ai config-init
        • release ai config-select
        • release ai config-upsert
      • release apps
        • release apps list
        • release apps select
      • release auth
        • release auth login
        • release auth logout
      • release builds
        • release builds create
      • release clusters
        • release clusters exec
        • release clusters kubeconfig
        • release clusters shell
      • release datasets
        • release datasets list
        • release datasets refresh
      • release deploys
        • release deploys create
        • release deploys list
      • release development
        • release development logs
        • release development start
      • release environments
        • release environments config-get
        • release environments config-set
        • release environments create
        • release environments delete
        • release environments get
        • release environments list
        • release environments vars-get
      • release gitops
        • release gitops init
        • release gitops validate
      • release instances
        • release instances exec
        • release instances logs
        • release instances terminal
  • Release.ai
    • Release.ai Introduction
    • Getting Started
    • Release.ai Templates
    • Template Configuration Basics
    • Using GPU Resources
    • Custom Workflows
    • Fine Tuning LlamaX
    • Serving Inference
Powered by GitBook
On this page
  • Why to use environment variables
  • How to create default environment variables for your environments
  • How to edit an application's default environment variables
  • Default environment variables file structure
  • Individual environment variable schema
  • How Release uses an application's default environment variables file
  • Release's environment variables
  • RELEASE_ACCOUNT_ID
  • RELEASE_APP_NAME
  • RELEASE_BRANCH_NAME
  • RELEASE_BUILD_ID
  • RELEASE_CLOUD_PROVIDER
  • RELEASE_CLUSTER_REGION
  • RELEASE_COMMIT_SHA
  • RELEASE_COMMIT_SHORT
  • RELEASE_CONTEXT
  • RELEASE_DOMAIN
  • RELEASE_ENV_ID
  • RELEASE_RANDOMNESS
  • Release's service-specific environment variables
  • Mapping environment variables in the mapping section
  • Mapping Release's variables
  • Mapping your app's environment variables
  • Combining existing variables and strings to create new variables
  • The defaults section
  • The services section

Was this helpful?

  1. Reference documentation
  2. Application settings

Default environment variables

How to create and manage default environment variables for your Release environments

PreviousSchema definitionNextGitHub

Last updated 11 months ago

Was this helpful?

Why to use environment variables

Environment variables hold the environment-specific information that an application needs at runtime.

For instance, a web application deployed in a production environment has to know how to access the production database. The same application running in a staging environment would have to know about a staging database instead.

By storing configuration as environment variables instead of in code, you'll make your applications portable, secure, and easy to deploy on Release environments.

How to create default environment variables for your environments

When you create a new application, Release generates a default environment variables file, based on your code.

For example, if your repository has a docker-compose.yml file, Release will populate the default environment variables for your new application based on the environment variables in that file.

If your repository does not have a docker-compose.yml file, you can create your Release application's default environment variables manually, by editing your application's settings.

How to edit an application's default environment variables

To edit the default environment variables for an application, visit the application's App Settings page, then click the Environment Variables button.

This opens a YAML editor, which you can use to edit your default environment variables file.

Default environment variables file structure

A Release application's default environment variables file is formatted in YAML, and consists of three sections:

Section
Type
Required
Description

Hash

false

Array

true

Default environment variables for your app

Hash

false

Service-specific environment variables

Here's an example of a default environment variables file:

mapping:
  COMMIT_HASH: RELEASE_COMMIT_SHA
  AWS_REGION: RELEASE_CLUSTER_REGION
defaults:
  - key: DEFAULT_LANG
    value: en
  - key: DB_HOSTNAME
    value: db
services:
  admin:
  - key: DB_USERNAME
    value: admin_rw
  - key: DB_PASSWORD
    secret: true
  frontend:
  - key: DB_USERNAME
    value: user_ro
  - key: DB_PASSWORD
    secret: true

Individual environment variable schema

Field
Type
Required
Description

key

String

True

The environment variable's name. It is convention to use uppercase names for environment variables. Example: DB_USERNAME

value

String or Null

True

The value for this environment variable. Required if secret is false. If secret is true, this field is optional, and Release defaults to the previously saved value if this field is omitted.

secret

Boolean

False

Here's an example of three environment variables:

defaults:
  - key: DEFAULT_LANG
    value: en
  - key: DB_HOSTNAME
    value: db
  - key: DB_PASSWORD
    value:
    secret: true

How Release uses an application's default environment variables file

When you create a new environment, Release uses the application's default environment variables file to generate an environment-specific environment variables file for your new environment.

Think of an application's default environment variables file as the blueprint for each new environment's environment variables.

Release's environment variables

Apart from the environment variables lifted from your docker-compose.yml, and the variables you created yourself, Release provides additional environment variables.

Environment variables provided by Release have names that start with RELEASE_.

Here's an overview of the variables provided by Release:

RELEASE_ACCOUNT_ID

Release account ID: Each Release account has a unique numerical identifier.

RELEASE_APP_NAME

Release application name: Each Release application has a unique string identifier.

RELEASE_BRANCH_NAME

Git branch: The name of the git branch from your repository deployed to this environment.

RELEASE_BUILD_ID

Release build ID: Each Release build has a unique numerical identifier.

RELEASE_CLOUD_PROVIDER

Cloud provider: The cloud provider that hosts this environment. For example, aws or gcp.

RELEASE_CLUSTER_REGION

Cloud provider region: The cloud provider region for this environment. For example, us-west-2 or us-east-1.

RELEASE_COMMIT_SHA

Git hash: The SHA hash of the git commit deployed in this environment. This refers to a commit in your repository.

RELEASE_COMMIT_SHORT

Short git hash: The short hash of the git commit deployed in this environment. This refers to a commit in your repository.

RELEASE_CONTEXT

Release context: Refers to the Kubernetes context for this deployment.

RELEASE_DOMAIN

Release domain: If you do not have a custom domain set up on your Release account, this will be rls.sh.

RELEASE_ENV_ID

Release environment ID: Each Release environment has a unique string identifier.

RELEASE_RANDOMNESS

Release random string: This short random string is used to create unique links.

Release's service-specific environment variables

Release also provides environment variables specific to each service in your environment.

When creating these variables, Release converts the service name to uppercase and prepends this to each service-specific environment variable's name.

For example, if you have two services, admin and frontend, Release provides environment variables as follows:

ADMIN_COMMIT_SHA

Short git hash: The SHA hash of the git commit deployed for this service. This refers to a commit in your repository.

ADMIN_COMMIT_SHORT

Short git hash: The short hash of the git commit deployed for this service. This refers to a commit in your repository.

ADMIN_INGRESS_HOST

Ingress hostname: The hostname of the instance/load balancer for this service, accessible to the internet.

ADMIN_INGRESS_URL

Ingress URL: The public URL for this service.

FRONTEND_INGRESS_URL, FRONTEND_INGRESS_HOST etc.

The equivalent environment variables are provided for the frontend service in this example.

Mapping environment variables in the mapping section

You can use the mapping section to map existing environment variables to new environment variables.

Mapping Release's variables

In the example below, your code expects an environment variable called AWS_REGION. Mapping allows you to pass RELEASE_CLUSTER_REGION to your application, adding its value to a new environment variable called AWS_REGION.

mapping:
  COMMIT_HASH: RELEASE_COMMIT_SHA
  AWS_REGION: RELEASE_CLUSTER_REGION
  REACT_APP_ADMIN_BASE_URL: ADMIN_INGRESS_URL
  REACT_APP_FRONTEND_BASE_URL: FRONTEND_INGRESS_URL

Mapping your app's environment variables

The mapping section also allows you to reference your app's environment variables. In the example below, REACT_APP_ADMIN_PATH gets its value from DEFAULT_ADMIN_PATH:

defaults:
  - key: DEFAULT_ADMIN_PATH
    value: /admin/
mapping:
  REACT_APP_ADMIN_BASE_URL: ADMIN_INGRESS_URL
  REACT_APP_ADMIN_PATH: DEFAULT_ADMIN_PATH

Combining existing variables and strings to create new variables

Release's mapping section allows you to create new environment variables through string interpolation.

In the example below, ADMIN_FULL_URL is created by concatenating ADMIN_INGRESS_URL and DEFAULT_ADMIN_PATH:

defaults:
  - key: DEFAULT_ADMIN_PATH
    value: /admin/
mapping:
  ADMIN_FULL_URL: "${ADMIN_INGRESS_URL}${DEFAULT_ADMIN_PATH}"

You can also provide default values if an environment variable is unset or empty.

In the example below, if MAYBE_EMPTY_BASE_URL does not exist, or is empty, the default https://example.com will take its place.

mapping:
  ADMIN_FULL_URL: "${MAYBE_EMPTY_BASE_URL:-'https://example.com'}/admin/"

The syntax to indicate a default is based on parameter expansion in bash: ${parameter:-defaultvalue}, but unlike in bash, defaultvalue is interpreted as a string. defaultvalue can't reference an environment variable.

String interpolation and parameter expansion is limited to the mapping section of your environment variables YAML.

The defaults section

The defaults section contains environment variables that are available to all services in an environment.

Here's an example of the defaults section:

defaults:
  - key: DEFAULT_LANG
    value: en
  - key: DB_HOSTNAME
    value: db

The services section

Use the services section to define environment variables for specific services only. Each service in this section has one or more environment variables.

Here's an example of service-specific environment variables:

services:
  admin:
  - key: DB_USERNAME
    value: admin_rw
  - key: DB_PASSWORD
    secret: true
  frontend:
  - key: DB_USERNAME
    value: user_ro
  - key: DB_PASSWORD
    secret: true

Maps to your app's environment variables

Environment variables consist of a key, a value, and an optional secret flag. Mark an environment variable as secret using secret=true. Secrets are encrypted at rest in a vault and hidden in the UI. You may also import secret environment variables from external secrets managers. See the for more on secrets.

Value is and should be encrypted. Value will be hidden from Release UI. Defaults to false.

You can to your app's environment variable names so that you do not need to change your application's code when deploying on Release or elsewhere.

By mapping to your app's environment variables, you do not need to reference Release-specific environment variable names in your code.

instructions here
map Release's environment variables
Release's environment variables
secret
mapping
Release variables
defaults
services
Edit the default environment variables