{% macro mqtt_config(values) -%}
# Changes in this file will be lost at the next restart
# Use {{ values.consts.extra_config_path }} directory for additional configuration
listener {{ values.network.broker_port }}

{%- if values.network.enable_ws %}
listener {{ values.network.ws_port }}
protocol websockets
{%- endif %}

log_dest stdout
allow_anonymous {{ "true" if values.mosquitto.allow_anonymous else "false" }}

persistence {{ "true" if values.mosquitto.enable_persistence else "false" }}
{%- if values.mosquitto.enable_persistence %}
persistence_location {{ values.consts.data_path }}
autosave_interval {{ values.mosquitto.autosave_interval }}
{%- endif %}

include_dir {{ values.consts.extra_config_path }}
{% endmacro %}
