Skip to content

Environment System

Manages environment variables through configurable storage backends.

The environment system separates storage from access:

  • Storages - Where values are stored (OS, files, memory)
  • Variables - Named references to values in storages

Variables can be referenced by:

  • Public name - The variable field value (must be unique across the system)
  • Entry ID - Full namespace:name reference

If you don’t want a variable to be publicly accessible by name, omit the variable field.

KindDescription
env.storage.memoryIn-memory key-value storage
env.storage.fileFile-based storage (.env format)
env.storage.osRead-only OS environment access
env.storage.staticRead-only static key-value storage
env.storage.routerChains multiple storages
env.variableNamed variable referencing a storage

Volatile in-memory storage.

- name: runtime_env
kind: env.storage.memory

Persistent storage using .env file format (KEY=VALUE with # comments).

- name: app_config
kind: env.storage.file
file_path: /etc/app/config.env
auto_create: true
file_mode: 0600
dir_mode: 0700
PropertyTypeDefaultDescription
file_pathstringrequiredPath to .env file
auto_createbooleanfalseCreate file if missing
file_modeinteger0644File permissions
dir_modeinteger0755Directory permissions

Read-only access to operating system environment variables.

- name: os_env
kind: env.storage.os

Always read-only. Set operations return PERMISSION_DENIED.

Read-only storage with values defined directly in configuration. Values are baked into the entry and cannot be changed at runtime. Useful for public configuration constants that ship with a module or pack.

- name: defaults
kind: env.storage.static
values:
PUBLIC_API_HOST: "https://api.example.com"
PUBLIC_WS_HOST: "wss://api.example.com/ws"
APP_ENV: "production"
PropertyTypeDescription
valuesmapKey-value pairs (string to string)

Always read-only. Set operations return PERMISSION_DENIED.

Chains multiple storages. Reads search in order until found. Writes go to first storage only.

- name: config
kind: env.storage.router
storages:
- app.config:memory # Primary (writes here)
- app.config:file # Fallback
- app.config:os # Fallback
PropertyTypeDescription
storagesarrayOrdered list of storage references

Variables provide named access to storage values.

- name: DATABASE_URL
kind: env.variable
variable: DATABASE_URL
storage: app.config:file
default: postgres://localhost/app
readonly: false
PropertyTypeDescription
variablestringPublic variable name (optional, must be unique)
storagestringStorage reference (namespace:name)
defaultstringDefault value if not found
readonlybooleanPrevent modifications

Variable names must contain only: a-z, A-Z, 0-9, _

# Public variable - accessible by name "PORT"
- name: port_var
kind: env.variable
variable: PORT
storage: app.config:os
default: "8080"
# Private variable - accessible only by ID "app.config:internal_key"
- name: internal_key
kind: env.variable
storage: app.config:secrets
ConditionKindRetryable
Variable not founderrors.NOT_FOUNDno
Storage not founderrors.NOT_FOUNDno
Variable is read-onlyerrors.PERMISSION_DENIEDno
Storage is read-onlyerrors.PERMISSION_DENIEDno
Invalid variable nameerrors.INVALIDno