Configuration

Variables

Secrets, user configuration, typed values, and config options in Lawn templates.
The catalog is community-driven. Want to add an app? Open a PR on GitHub. Support for custom catalogs from other sources is coming soon.

Lawn's configuration system handles three categories of values:

  1. Secrets — Generated passwords and API keys
  2. User input — Values provided during installation
  3. Configuration — Selectable options with typed controls (toggles, pickers, number fields)

Variables are defined in the template, resolved at install time, and injected into containers at startup. Display strings (displayName, description, option labels) live in the localization file, not in the YAML.

Variable Types

TypeDeclared inResolvedUse case
Generated Secretx-lawn.configAt installPasswords, API keys, tokens
User Providedx-lawn.configAt install (user input)Values the user must supply
Config Optionx-lawn.configAt config changeSelectable choices with compose overlays
SystemBuilt-inAt startupTimezone, UID, GID
PortBuilt-inAt startupHost port assignments

For per-service environment metadata (format hints, descriptions), see Environment Metadata.

Generated Secrets

A random alphanumeric string created at install time. Use for passwords, API keys, and tokens that users don't need to choose.

lawn-compose/v1.0.0.yaml
x-lawn:
  config:
    SECRET_KEY:
      source: generatedSecret
      length: 50
FieldDefaultDescription
sourceMust be generatedSecret
length32Character count of the generated string

Generated secrets are created once at install time and never change. Lawn stores the value per-instance so it survives container restarts and updates.

User Provided

A value the user supplies during installation. The CLI prompts interactively, and the GUI shows a required field in the install sheet.

lawn-compose/v1.0.0.yaml
x-lawn:
  config:
    ADMIN_PASSWORD:
      source: userProvided

The install button stays disabled until all userProvided variables have values. If the compose environment has a ${VAR:-default} fallback, that default is used when no value is provided.

For non-interactive installs, supply values with --var flags:

lawn catalog install github-actions-runner --var REPO_URL=https://github.com/your-org/your-repo
Avoid passing secrets as CLI arguments — they are visible in shell history and process listings. Use the interactive prompt for sensitive values.

Config Options

Config variables can define selectable options, where each option carries a compose overlay that Lawn merges as an additional layer. This gives users a curated set of choices instead of raw environment variable editing.

lawn-compose/latest.yaml
x-lawn:
  config:
    DIFFICULTY:
      value: easy
      weight: 10
      options:
        peaceful:
          compose:
            services:
              minecraft:
                environment:
                  DIFFICULTY: peaceful
        easy:
          compose:
            services:
              minecraft:
                environment:
                  DIFFICULTY: easy
        normal:
          compose:
            services:
              minecraft:
                environment:
                  DIFFICULTY: normal
        hard:
          compose:
            services:
              minecraft:
                environment:
                  DIFFICULTY: hard

Each option's compose block is a standard compose document fragment. When the user selects "hard", Lawn merges that fragment into the active configuration — setting DIFFICULTY: hard in the container's environment.

Options are not limited to environment variables. A compose overlay can change ports, volumes, resource limits, or any other compose field.

Input Types

The inputType field controls how the UI renders the config variable:

inputTypeUI ControlOptions Required
(omitted)Picker (if options) or text fieldNo
booleanToggle switchYes (exactly 2, keyed "true" and "false")
numberNumber input fieldNo
textText input fieldNo

Boolean toggle — use inputType: boolean with exactly two options:

lawn-compose/latest.yaml
PVP:
  inputType: boolean
  value: true
  weight: 30
  options:
    "true":
      compose:
        services:
          minecraft:
            environment:
              PVP: "TRUE"
    "false":
      compose:
        services:
          minecraft:
            environment:
              PVP: "FALSE"

The localization file provides labels for each option (e.g., "On"/"Off" or "Enabled"/"Disabled").

Number input — use inputType: number for integer values:

SPAWN_PROTECTION:
  inputType: number
  value: 16
  weight: 170

Text input — use inputType: text for free-form strings:

SEED:
  inputType: text
  value: ""
  weight: 130

Display Ordering

The weight field controls the display order in the UI. Lower values appear first. Variables with the same weight are sorted alphabetically. The default is 0.

x-lawn:
  config:
    DIFFICULTY:
      weight: 10    # Appears first
    HARDCORE:
      weight: 20    # Appears second
    PVP:
      weight: 30    # Appears third

Config Variable Fields

FieldDefaultDescription
sourcegeneratedSecret or userProvided (omit for config options without a source)
length32Character count for generated secrets
valueDefault value (string, boolean, or number)
inputTypeUI control: boolean, number, or text
weight0Display order (lower values first)
optionsMap of option values to compose overlays

System Variables

These are always available in every template — Lawn injects them automatically.

VariableDescriptionExample
TIMEZONEUser's IANA timezoneEurope/Amsterdam
UIDHost user ID501
GIDHost group ID20

Use them with fallbacks: ${TIMEZONE:-UTC}, ${UID:-1000}, ${GID:-1000}.

Never declare system variables in x-lawn.config — they are injected by the engine and always available.

Port Variables

The engine injects HOST_PORT_<N> for each exposed port at container start:

VariableDescription
HOST_PORT_<N>Resolved host port for container port N

For example, if container port 8080 maps to host port 51811, then HOST_PORT_8080=51811.

Usage in Compose Files

Use substitution syntax in environment values to reference variables:

lawn-compose/v1.0.0.yaml
services:
  db:
    image: postgres:15
    environment:
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-changeme}
      TZ: ${TIMEZONE:-UTC}

Lawn substitutes the real values at runtime. The :-default fallback keeps compose files valid for standalone use with docker compose up.

Substitution Syntax

Lawn supports the full Docker Compose variable substitution syntax:

SyntaxDescription
$VAR or ${VAR}Substitute the value of VAR
${VAR:-default}Use default if VAR is unset or empty
${VAR-default}Use default if VAR is unset
${VAR:+replacement}Use replacement if VAR is set and non-empty
${VAR+replacement}Use replacement if VAR is set
${VAR:?error}Error if VAR is unset or empty
${VAR?error}Error if VAR is unset
$$Literal $ (escaped)
The most common form is ${VAR:-default}. Always provide a fallback so the compose file works standalone with docker compose config.

When to Use What

ScenarioApproach
Passwords and secrets the user doesn't choosegeneratedSecret in x-lawn.config
Values the user must provide (API keys, repo URLs)userProvided in x-lawn.config
Selectable settings with discrete choicesConfig options with compose overlays
Boolean toggles (on/off features)inputType: boolean with two options
Numeric settings (ports, distances, limits)inputType: number
Free-form text (world names, seeds)inputType: text
Static settings that need a description in the UIPer-service x-lawn.environment (Environment Metadata)
Timezone, user/group IDsSystem variables (always available)
Dynamic port assignmentsPort variables (always injected)