v1

Run /

Inject runtime variables

You can set runtime variables (ENV) to be passed to the Docker container at runtime. You can set runtime variables in individual resources, or create a secret group so that multiple resources in a project can inherit the same secrets.

You can also upload secret files to make certificates, configuration files, and other data available in your containers.

Editing runtime variables in the Northflank application

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

Access environment variables in your code

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 environmentEnvironment variable accessorRequired import
Nodeprocess.env.ENV_KEYnone
DenoDeno.env.get("ENV_KEY")none
BunBun.env.ENV_KEY OR process.env.ENV_KEYnone
Pythonos.environ.get("ENV_KEY")import os
JavaSystem.getenv("ENV_KEY")none
KotlinSystem.getenv("ENV_KEY")none
Ruby on RailsENV["ENV_KEY"]none
Rustenv::var("ENV_KEY")use std::env
Goos.Getenv("ENV_KEY")import ( "os" )
C# / .NETEnvironment.GetEnvironmentVariable("ENV_KEY")using System;
C++std::getenv("ENV_KEY")#include <cstdlib>
Cgetenv("ENV_KEY")#include <stdlib.h>
PHP.$_ENV["ENV_KEY"]none
Luaos.getenv("ENV_KEY")none
Shell / Bash${ENV_KEY}none
PowerShell$Env:ENV_KEY OR [Environment]::GetEnvironmentVariable('ENV_KEY')none

Add a secret file to a deployment

You can include secret files which can be accessed in your container's file system. This can be useful to provide certificates, secrets, or configuration files that must are required by your application, but which should not be included in your repository.

To add a secret file, paste or upload the content in the secret file editor on the environment page of a deployment service, combined service, or a job. You can also upload secret files to secret groups to make them available to multiple resources in the same project.

© 2024 Northflank Ltd. All rights reserved.