Run /
Inject runtime variables
Available on combined and deployment services.
Runtime variables (ENV) can be set to be passed to the Docker container at runtime. These can be set for individual service, or set as project secrets to be applied to all or specific services in a project.
Runtime variables can be set as key-value pairs, or as JSON in the following format:
{
"KEY_1": "value1",
"KEY_2": "value2"
}
An .env
file can also be uploaded and edited using the following format:
KEY_1=value1
KEY_2=value2
Your runtime variables can be accessed via the process environment, for example in a Node environment a variable set as ENV_VALUE=Northflank
can be accessed within the container by referring to process.env.ENV_VALUE
.
Runtime environment | Environment variable accessor | Required import |
---|---|---|
Node | process.env.ENV_VALUE | none |
Deno | Deno.env.get("ENV_VALUE") | none |
Python | os.environ.get("ENV_VALUE") | import os |
PHP | .$_ENV["ENV_VALUE"] | none |
Ruby on Rails | ENV["ENV_VALUE"] | none |
Rust | env::var("ENV_VALUE") | use std::env |
Java | System.getenv("ENV_VALUE") | none |