Skip to main content

Introduction

Environment variables let you pass configuration values to your application at runtime without modifying the container image. In Edge Infrastructure Services, environment variables for application instances are delivered through the custom configuration mechanism using the cloud-init standard. This procedure covers two approaches:
  • Key-value pairs: pass simple VARIABLE_NAME=VALUE pairs to the application as environment variables.
  • File injection: write a file (for example, a certificate or configuration file) to the container filesystem before startup.
For background on how custom configuration works, see Custom Configuration for Applications.

Prerequisites

  • You have the SysManager or SysAdmin role in your enterprise. See Manage Roles.
  • You are working with a Container or VM app type. Docker Compose environment variables are handled through the compose file.

How Environment Variables Are Delivered

EVE-OS (Edge Virtualization Engine) delivers cloud-init configuration to application instances when they start. For container instances, EVE-OS parses the custom configuration and applies it directly (no cloud-init daemon required in the container):
  • Simple key-value format: use VARIABLE_NAME=VALUE pairs, one per line. This is the legacy format supported across all EVE-OS LTS versions.
  • Cloud-init format: use the standard cloud-init runcmd field to set environment variables, and optionally write_files to inject files. Available since EVE-OS 11.3.
For VM instances, EVE-OS uses the NoCloud data source to provide the configuration to the VM via a virtual CD-ROM. The VM must have cloud-init installed and running to consume it.

Set Up Environment Variables in the App Image

Environment variables passed via custom configuration are defined as part of the edge app image. Add the custom configuration template and variable groups to the app image before deploying any instances.
  1. Navigate to Infrastructure > Workloads > Build > App Images.
  2. Open the app image or click Add Image to create a new one.
  3. In the Custom Configuration section, enable custom configuration.
  4. Add a variable group to hold your environment variable definitions.
  5. For each environment variable you want to expose:
    • Add a variable of type Text or Password (for sensitive values).
    • Set the Name to the variable identifier used in the template (for example, API_KEY).
    • Set the Label to a user-friendly name (for example, “API Key”).
    • Mark it as Required if a value must always be provided.
  6. In the Configuration Template, enter the cloud-init content that sets the environment variables. Use the field delimiter to reference each variable. For example, if the delimiter is ###:
For VM instances, the template must begin with #cloud-config:
  1. Save the app image.

Inject a File into a Container

To write a file (for example, a certificate) to the container filesystem, use the write_files cloud-init directive in the configuration template.
  1. In the app image’s custom configuration, add a variable of type File named CERT_CONTENT (or a name appropriate for your use case).
  2. In the Configuration Template, reference the variable in a write_files block:
At deploy time, the user provides the base64-encoded certificate content. EVE-OS writes the decoded file to /etc/myapp/server.cert.pem before starting the container.

Supply Variable Values at Deploy Time

When you deploy an instance from the app image, the Custom Config step in the wizard prompts for the values of each variable you defined.
  1. Navigate to Infrastructure > Workloads > Applications.
  2. Select the contextual + create action and select the app image.
  3. Complete the App & Target and Interfaces steps.
  4. In the Custom Config step, enter values for each environment variable.
  5. Complete the wizard and click Create Application.
The values are delivered to the instance when it starts.

Update Environment Variables

After an instance is deployed, changing environment variable values requires a restart or reactivation to take effect:
  • If the app image allows configuration override, click the Configure (gear) icon on the instance detail page to update the values.
  • Changes to the variable groups themselves (adding, removing, or renaming variables) require deleting and redeploying the instance with the updated configuration.

Use a System Variable

Edge Infrastructure Services provides built-in system variables that are automatically replaced with platform values at deploy time. For example, you can include the node name in the configuration without knowing it at authoring time. Refer to the custom configuration settings in the app image for the list of available system variables and their syntax.

Next Steps

Custom Configuration for Applications

The full custom configuration reference, including all variable types and template syntax.

Deploy an Application Instance

The full deployment wizard walkthrough.

Add an Edge App Image

Create a new app image with environment variable support.