Some checks failed
Rust CI / Security Audit (push) Has been cancelled
Rust CI / Check + Test + Lint (nightly) (push) Has been cancelled
Rust CI / Check + Test + Lint (stable) (push) Has been cancelled
mdBook Build & Deploy / Build mdBook (push) Has been cancelled
Nickel Type Check / Nickel Type Checking (push) Has been cancelled
mdBook Build & Deploy / Documentation Quality Check (push) Has been cancelled
mdBook Build & Deploy / Deploy to GitHub Pages (push) Has been cancelled
mdBook Build & Deploy / Notification (push) Has been cancelled
1.3 KiB
1.3 KiB
Configuration Format Templates
Jinja2 templates for generating configuration files in different formats.
Templates
toml.j2
Generate TOML configuration files from Nickel JSON output.
Usage:
nickel export vapora.solo.ncl | \
jinja2 templates/configs/toml.j2 > vapora.toml
Output: TOML format compatible with services
yaml.j2
Generate YAML configuration files from Nickel JSON output.
Usage:
nickel export vapora.multiuser.ncl | \
jinja2 templates/configs/yaml.j2 > vapora.yaml
Output: YAML format for Kubernetes, Ansible, etc.
json.j2
Pass-through JSON formatting with pretty-printing.
Usage:
nickel export vapora.enterprise.ncl | \
jinja2 templates/configs/json.j2 > vapora.json
Output: Formatted JSON
Template Format
Templates iterate over the configuration object:
{% for section, values in config.items() %}
[{{ section }}]
{% for key, value in values.items() %}
{{ key }} = {{ format_value(value) }}
{% endfor %}
{% endfor %}
Workflow
Nickel Config File (.ncl)
↓
Export to JSON (nickel export)
↓
Render Template (jinja2)
↓
Output File (TOML, YAML, JSON, etc.)
References
- Parent:
../README.md - Jinja2 docs: https://jinja.palletsprojects.com/