paulbsd-salt/states/nextcloud/templates/config.php.j2
2021-08-19 21:15:24 +02:00

30 lines
831 B
Django/Jinja

<?php
{%- from "nextcloud/map.jinja" import nextcloud with context %}
{%- macro mac(value,last) -%}
{%- if value is mapping %}
{%- for k, v in value.items() %}
{%- if v is true or v is false or v is number %}
"{{ k }}" => {{ v|lower }}{% if last %},{% else %}{% endif %}
{%- else %}
"{{ k }}" => "{{ v }}"{% if last %},{% else %}{% endif %}
{%- endif %}
{%- endfor %}
{%- elif value is sequence and value is not string -%}
array(
{%- for value2 in value %}
{{ mac(value2,loop.last) }}
{%- endfor -%}
),
{%- elif value is true or value is false -%}
{{ value|lower }},
{%- elif value is number -%}
{{ value }},
{%- else -%}
"{{ value }}",
{%- endif %}
{%- endmacro %}
$CONFIG = array(
{%- for key, value in nextcloud.config.items() %}
"{{ key }}" => {{ mac(value,loop.last) }}
{%- endfor %}
);