ansible-role-prosody-master/templates/prosody-value.j2

32 lines
859 B
Text
Raw Normal View History

2022-10-11 09:19:07 +02:00
{#
Template fragment implementation Prosody configuration file
data types. This fragment parses the given value (`v`) and
performs the appropriate syntactic transformations in order to
write syntactically correct Lua configuration code.
FIXME: Boolean values should be treated as booleans.
Not sure why we need to detect a string here.
Is `sameas` not testing appropriately?
#}
{% if v is sameas true or "true" == v %}
true
{% elif v is sameas false or "false" == v%}
false
{% elif v is string %}
"{{ v }}"
{% elif v is number %}
{{ v }}
{% elif v is mapping %}
{
{% for x, y in v.items() %}
{% with v = y %}{% include "prosody-value.j2" %};{% endwith %}{{''}}
{% endfor %}
}
{% elif v is sequence %}
{
{% for x in v %}
{% with v = x %}{% include "prosody-value.j2" %};{% endwith %}{{''}}
{% endfor %}
}
{% endif %}