{%- if 'ui' in definition.sections | map(attribute='name') %}
{%- set component = 'gateway' %}
{%- else %}
{%- set component = 'agent' %}
{%- endif -%}
# This file is an example configuration file for Slurm-web {{ component }}
#
# Please DO NOT USE THIS FILE as a basis for your custom
# /etc/slurm-web/{{ component }}.ini.
#
# This example file contains example values for all parameters but most
# parameters are actually optional. You are supposed to define only the sections
# and parameters that are either really required or those for which you want to
# override default value.
#
# Please read Slurm-web quickstart guide to understand the parameters you are
# supposed to define in most cases:
#
# https://docs.rackslab.io/slurm-web/install/quickstart/index.html
{%- for section in definition.sections %}

[{{ section.name }}]
{%- for parameter in section.parameters if not parameter.deprecated %}

# {{ parameter.doc | wordwrap(wrapstring='\n# ')}}
{%- if parameter.choices %}
#
# Possible values:
{%- for choice in parameter.choices %}
# - {{ choice }}
{%- endfor %}
{%- endif %}
{%- if parameter.default %}
{%- set default = parameter.default %}
{%- if parameter._type == "bool" %}
{%- set default = "yes" if default == True else "no" %}
{%- elif parameter._type == "uri" and default is not none %}
{%- set default = default.geturl() %}
{%- endif %}
#
{%- if default.__class__.__name__ == 'list' %}
{%- set default = "# - " + default | join('\n# - ') %}
# Default value:
{{ default }}
{%- else %}
# Default value: {{ default }}
{%- endif %}
{%- endif %}
{%- if parameter.required %}
#
# This parameter is required.
{%- endif %}

{%- if parameter.example %}
{%- set value = parameter.example %}
{%- else %}
{%- set value = parameter.default %}
{%- endif %}
{%- if value is not none %}
{%- if parameter._type == "uri" and value.geturl is defined %}
{%- set value = value.geturl() %}
{%- endif %}
{%- if parameter._type == "bool" %}
{%- set value = "yes" if value == True else "no" %}
{%- endif %}
{%- if value.__class__.__name__ == 'list' %}
{%- set value = "\n  " + value | join('\n  ') %}
{%- endif %}
{{ parameter.name }}={{ value }}
{%- endif %}
{%- endfor %}
{%- endfor %}
