Skip to Content
Alzo

Secrets and parameters

Secrets come from the environment. That is the entire mechanism.

const dbPassword = dev ? 'dev' : secret('POSTGRES_PASSWORD');

secret() reads from the process environment, has no default, and is redacted by value everywhere — including in a service's own output, which a marker-based approach cannot do. Redaction happens before anything is retained, so it covers logs, the dashboard, error output and --json alike, and a redacted value prints as ${POSTGRES_PASSWORD} rather than a row of dots. A missing secret is a load error naming the variable and the node.

'dev' is not a secret and should not be dressed as one. A literal in a committed development configuration is fine and honest.

How a secret reaches a process

Evaluating the configuration keeps the symbolic ${NAME} spelling, and Alzo binds the real value only when it starts the process. Prefer env: { PASSWORD: secret('POSTGRES_PASSWORD') }: it delivers the exact bytes, including quotes and $, without shell interpretation. A container that consumes a secret is recreated each time the environment loads its configuration, including on reload; that does not rotate credentials inside a retained database.

This is substitution, not string transformation or escaping. Encoding, hashing or JSON-serialising a symbolic secret in the configuration does not operate on the credential, and values captured by a ready.check or a callback teardown also remain symbolic. Shell strings receive raw substitution, not quoting: pass credentials through env, and quote the environment variable in the shell instead of interpolating secret() into shell source.

.env files

Alzo does not read .env files. Parsing them is a solved problem that we would solve worse, and it is actively incompatible with encrypted .env files, which Alzo would see as ciphertext. Use a loader:

{
  "scripts": {
    "dev": "dotenvx run -- alzo up"
  }
}

This also means direnv, per-environment files and CI-injected variables all work with no involvement from Alzo at all.

Because the configuration is TypeScript rather than YAML, per-service environment files need no feature from Alzo either — import a parser and scope the result to one node:

import { config } from '@dotenvx/dotenvx';

const webEnv = config({ path: 'apps/web/.env' }).parsed ?? {};

const web = defineService({
  name: 'web',
  provision: { image: 'ghcr.io/acme/web' },
  env: webEnv,
});

You get the real parser, including decryption of encrypted files, scoped to exactly the service that needs it — and ?? {} is Compose's required: false.

One boundary worth knowing: redaction is by value, and the value set is what secret() returned. Values loaded this way are ordinary strings Alzo cannot distinguish from 'dev', so they are not redacted. If a variable in such a file is sensitive and you want it masked in logs and the dashboard, read it through secret() instead.

Parameters

A parameter is the other half: a declared, typed, described value that the run supplies, read the same way:

const debug = param('debug', { type: 'boolean', default: false, description: 'Run under the inspector' });
const seed = param('seed', { options: ['minimal', 'demo', 'full'], default: 'minimal' });

const api = defineService({
  name: 'api',
  ports: { http: {}, inspect: { hostPort: 9229, internal: true } },
  env: { SEED: seed },
  run: (self) => `node ${debug ? `--inspect=${self.port.inspect} ` : ''}server.js --port ${self.port.http}`,
});

Run alzo up --debug --seed=full. Parameter names begin with a lowercase letter and contain lowercase letters, digits or internal hyphens, giving every declaration one safe --name spelling. Booleans accept a bare --name or --name=true|false; strings, numbers and options use --name=value. An undeclared flag such as --debgu is a load error rather than an ignored typo. Repeated flags, malformed values, non-finite numbers and a non-boolean parameter given without =value are errors too.

alzo up --help lists this configuration's parameters with their defaults and resolved values, without constructing the graph. Help reserves no instance, so instance.id is empty while it runs. alzo plan and the up.started record carry the same values. A running environment remembers them, so status, down, lifecycle commands, run, exec and traces reopen the same graph without repeating the flags; an explicitly different value is refused before anything changes.

Parameter values are not secrets: help, plans, startup records and the running environment expose them. Use secret() for credentials. options narrows the return type. A parameter is a function rather than a field on defineConfig because settings and env are not evaluated lazily, so a parameter threaded through the node list could not reach them.

On this page