Documentation

configuration

Environment Variables

How to configure environment variables for your services.

Environment variables let you pass configuration to your services without hardcoding values. Runix supports three ways to set them: in runix.yaml, through the CLI, and in the dashboard.

Setting Variables#

Add an `env` section to any service definition:

runix.yaml
yaml
services:
  - name: api
    type: web-service
    repo: https://github.com/alice/api
    env:
      PORT: "3000"
      NODE_ENV: production
      API_KEY: "sk-abc123"

Precedence#

When the same variable is set in multiple places, this is the order of precedence (highest to lowest):

  1. 1.CLI / Dashboard — Variables set directly on the deployment always win
  2. 2.runix.yaml — Variables defined in the config file are applied at deploy time

Use runix.yaml for default values and the CLI or dashboard for environment-specific overrides (secrets, API keys, etc.).

Secret Variables#

Variables marked as secret are encrypted at rest using AES-256 encryption and are never shown in plain text in the dashboard or CLI output.

Secret values are masked in list output

bash
$ runix env list api
PORT = 3000
NODE_ENV = production
DATABASE_URL = ********

Secrets are still available in plain text inside the running container. Anyone with shell access to the container can read them.

Build-Time vs Runtime#

All environment variables in Runix are runtime variables. They are injected into the container when it starts, not during the build step. If your build process needs specific variables (like a Next.js API URL), you have two options:

  • Use a `build_command` in runix.yaml that sets the variable inline: `NEXT_PUBLIC_API_URL=https://api.example.com pnpm build`
  • Use a .env file committed to your repo for public build-time values

Auto-Injected Variables#

Runix automatically sets these variables in every container:

VariableDescriptionExample
`PORT`The port your service should listen on`3000`
`RUNIX_SERVICE_NAME`The name of the service`api`
`RUNIX_SERVICE_TYPE`The service type`web-service`
`RUNIX_INSTANCE_TYPE`The instance type`standard`

Managing Variables#

ActionCommand
List all`runix env list <service>`
Set / update`runix env set <service> KEY=VALUE`
Read one`runix env get <service> KEY`
Delete`runix env delete <service> KEY`