Template Rendering CLI

Generate configuration files from templates using the command line

Radiator provides a CLI subcommand for rendering configuration templates outside of the management UI. This enables automated configuration generation in deployment pipelines, scripted provisioning, or batch processing scenarios.

Usage

radiator template render <TEMPLATE_FILE> <VALUES_FILE> [OUTPUT_FILE]
ArgumentDescription
TEMPLATE_FILEPath to the template file (.radtmpl)
VALUES_FILEPath to a JSON file containing template values
OUTPUT_FILEPath where the rendered output is written (optional)

When OUTPUT_FILE is omitted, the rendered output is written to stdout.

Template File Format

Template files use the .radtmpl extension and contain two sections separated by marker lines:

  1. Metadata section: JSON object defining template fields and their types
  2. Template body: Handlebars-style template content
# radiator-config-template
{
  "description": "Example backend configuration",
  "items": [
    {
      "id": "BACKEND_NAME",
      "label": "Backend name",
      "type": "string"
    },
    {
      "id": "SECRET",
      "label": "Shared secret",
      "type": "string"
    },
    {
      "id": "ENABLE_DEBUG",
      "label": "Enable debug logging",
      "type": "boolean"
    }
  ]
}
# radiator-config-template
backends {
  file "{{{BACKEND_NAME}}}" {
    secret "{{{SECRET}}}";
    {{#if ENABLE_DEBUG}}
    debug true;
    {{/if}}
  }
}

Values File Format

The values file is a JSON object where keys match the id fields defined in the template metadata:

{
  "BACKEND_NAME": "my_backend",
  "SECRET": "supersecret123",
  "ENABLE_DEBUG": true
}

Template Syntax

The template body uses Handlebars syntax for variable substitution and control flow.

Variable Substitution

Use triple braces {{{variable}}} to insert values without HTML escaping (recommended for configuration files):

secret "{{{SECRET}}}";

Double braces {{variable}} apply HTML escaping, which is typically not needed for configuration files.

Missing Variables

Missing variables render as empty strings, allowing partial value sets during development or preview.

Example

Given the template file backend.radtmpl:

# radiator-config-template
{
  "description": "File backend configuration",
  "items": [
    {"id": "NAME", "label": "Backend name", "type": "string"},
    {"id": "SECRET", "label": "Secret", "type": "string"},
    {"id": "DEBUG", "label": "Debug mode", "type": "boolean"}
  ]
}
# radiator-config-template
backends {
  file "{{{NAME}}}" {
    secret "{{{SECRET}}}";
    {{#if DEBUG}}
    debug true;
    {{/if}}
  }
}

And values file values.json:

{
  "NAME": "production_backend",
  "SECRET": "prod_secret_456",
  "DEBUG": false
}

Running:

radiator template render backend.radtmpl values.json output.radconf

Produces output.radconf:

backends {
  file "production_backend" {
    secret "prod_secret_456";
  }
}

To output to stdout instead:

radiator template render backend.radtmpl values.json

Exit Codes

CodeMeaning
0Success
1Error (missing file, invalid JSON, template error)

Error Handling

The command fails with an error message when:

  • The template file does not exist or cannot be read
  • The values file does not exist or contains invalid JSON
  • The output file cannot be written (when specified)
  • The template contains syntax errors