{% if nextcloud.db.type == "mysql" or nextcloud.db.type == "mariadb" %}
NEXTCLOUD_DB_NAME={{ nextcloud.db.name | default("nextcloud") }}
{% elif nextcloud.db.type == "sqlite" %}
SQLITE_DATABASE={{ nextcloud.db.name + ".db" }}
{% endif %}

{% if not nextcloud.rewrite_ip %}
NEXTCLOUD_APACHE_DISABLE_REWRITE_IP=1
{% endif %}

NEXTCLOUD_TRUSTED_PROXIES={{ nextcloud.trusted.proxies | join(" ") }}
NEXTCLOUD_TRUSTED_FQDNS={{ "cloud." + web_fqdn }}
{% if compose.mode == "prod" %}
NEXTCLOUD_URL_REWRITE={{ "https://cloud." + web_fqdn }}
NEXTCLOUD_PROTOCOL_REWRITE=https
{% elif compose.mode == "dev" %}
NEXTCLOUD_URL_REWRITE={{ "http://cloud." + web_fqdn }}
NEXTCLOUD_PROTOCOL_REWRITE=http
{% endif %}