Variable substitution
String values in leilani.json can reference environment variables using ${NAME}. For example, "args": ["--database", "${DATABASE_URL}"] passes a stored connection string as an argument.
- Values inside a package’s configuration use shared variables plus that package’s overrides. Other fields, including users, rules, and HTTP settings, use shared workspace variables only.
- Substitution applies to string values, not object keys. You can substitute a hostname in a rule’s
hostsarray, but not a hostname key inhttp.binds. - The first placeholder in each string is replaced once. Expansion is not recursive; additional placeholders remain unchanged. Use one placeholder as the whole string, such as
"${DATABASE_URL}"; avoid prefix text before it. - A missing variable leaves the placeholder unchanged. Define every referenced variable before relying on the configuration.
- Substitution keeps the value a string. Numeric fields such as ports, body limits, and restart counts must be JSON numbers, not placeholders.
Variables configured through Environment are supplied to launched packages; they are not passed to the Cargo build process. There is no environment-variable map in leilani.json. Redeploy after changing variables to apply them to running packages. Start and Stop reuse the active deployment’s binaries, arguments, and environment. Config may show expanded values, so avoid placing secrets in ordinary configuration strings when your application can read them directly from its environment.