72 lines
1.3 KiB
Markdown
Raw Normal View History

2026-01-12 03:36:55 +00:00
# Configuration Format Templates
Jinja2 templates for generating configuration files in different formats.
## Templates
### `toml.j2`
Generate TOML configuration files from Nickel JSON output.
Usage:
```bash
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:
```bash
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:
```bash
nickel export vapora.enterprise.ncl | \
jinja2 templates/configs/json.j2 > vapora.json
```
Output: Formatted JSON
## Template Format
Templates iterate over the configuration object:
```jinja2
{% 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/