Expand description
MiniJinja integration for the Files API
This module provides a MiniJinja Object implementation that exposes the Files API to templates.
§Usage in Templates
{# Read a file as string #}
{{ files.get("config/nginx.conf") }}
{# Read and encode as base64 #}
{{ files.get("config/nginx.conf") | b64encode }}
{# Check if file exists #}
{% if files.exists("config/custom.yaml") %}
{{ files.get("config/custom.yaml") }}
{% endif %}
{# Iterate over files matching pattern #}
{% for file in files.glob("config/*.yaml") %}
{{ file.name }}: {{ file.content | b64encode }}
{% endfor %}
{# Read file lines #}
{% for line in files.lines("hosts.txt") %}
- {{ line }}
{% endfor %}Structs§
- Files
Object - MiniJinja Object wrapper for the Files API
Functions§
- create_
files_ value - Create a MiniJinja Value containing a FilesObject
- create_
files_ value_ from_ provider - Create a MiniJinja Value from a FileProvider