matrix-docker-ansible-deploy/roles/custom/matrix-ma1sd/templates/labels.j2
Slavi Pantaleev 48a4afb114 Make Traefik labels files look better
This moves the comments from being just in Jinja,
to actually ending up in the generated `labels` file,
which makes inspection of the final result easier.

Also, some new lines were added here and there to make labels
more legible.

The generated file may still include weird new-lines due to
various `if` statements yielding content or not, but that's not so ugly
anymore - now that we have proper start/end sections that are visible in
the final `labels` file.
2024-01-15 10:41:15 +02:00

119 lines
6.9 KiB
Django/Jinja

{% if matrix_ma1sd_container_labels_traefik_enabled %}
traefik.enable=true
{% if matrix_ma1sd_container_labels_traefik_docker_network %}
traefik.docker.network={{ matrix_ma1sd_container_labels_traefik_docker_network }}
{% endif %}
traefik.http.services.matrix-ma1sd.loadbalancer.server.port={{ matrix_ma1sd_container_port }}
{% if matrix_ma1sd_container_labels_matrix_identity_enabled %}
############################################################
# #
# Matrix Identity APIs (/_matrix/identity) #
# #
############################################################
traefik.http.routers.matrix-ma1sd-matrix-identity.rule={{ matrix_ma1sd_container_labels_matrix_identity_traefik_rule }}
{% if matrix_ma1sd_container_labels_matrix_identity_traefik_priority | int > 0 %}
traefik.http.routers.matrix-ma1sd-matrix-identity.priority={{ matrix_ma1sd_container_labels_matrix_identity_traefik_priority }}
{% endif %}
traefik.http.routers.matrix-ma1sd-matrix-identity.service=matrix-ma1sd
traefik.http.routers.matrix-ma1sd-matrix-identity.entrypoints={{ matrix_ma1sd_container_labels_matrix_identity_traefik_entrypoints }}
traefik.http.routers.matrix-ma1sd-matrix-identity.tls={{ matrix_ma1sd_container_labels_matrix_identity_traefik_tls | to_json }}
{% if matrix_ma1sd_container_labels_matrix_identity_traefik_tls %}
traefik.http.routers.matrix-ma1sd-matrix-identity.tls.certResolver={{ matrix_ma1sd_container_labels_matrix_identity_traefik_tls_certResolver }}
{% endif %}
############################################################
# #
# /Matrix Identity APIs (/_matrix/identity) #
# #
############################################################
{% endif %}
{% if matrix_ma1sd_container_labels_matrix_client_user_directory_search_enabled %}
############################################################
# #
# Matrix Client user-directory search API endpoint #
# (/_matrix/client/VERSION/user_directory/search) #
# #
############################################################
# ma1sd only supports /_matrix/client/r0/user_directory/search
# while we potentially handle /_matrix/client/v3/user_directory/search as well,
# so we need to transparently reroute.
traefik.http.middlewares.matrix-ma1sd-matrix-client-user-directory-search-replacepath.replacepath.path=/_matrix/client/r0/user_directory/search
traefik.http.routers.matrix-ma1sd-matrix-client-user-directory-search.rule={{ matrix_ma1sd_container_labels_matrix_client_user_directory_search_traefik_rule }}
traefik.http.routers.matrix-ma1sd-matrix-client-user-directory-search.middlewares=matrix-ma1sd-matrix-client-user-directory-search-replacepath
{% if matrix_ma1sd_container_labels_matrix_client_user_directory_search_traefik_priority | int > 0 %}
traefik.http.routers.matrix-ma1sd-matrix-client-user-directory-search.priority={{ matrix_ma1sd_container_labels_matrix_client_user_directory_search_traefik_priority }}
{% endif %}
traefik.http.routers.matrix-ma1sd-matrix-client-user-directory-search.service=matrix-ma1sd
traefik.http.routers.matrix-ma1sd-matrix-client-user-directory-search.entrypoints={{ matrix_ma1sd_container_labels_matrix_client_user_directory_search_traefik_entrypoints }}
traefik.http.routers.matrix-ma1sd-matrix-client-user-directory-search.tls={{ matrix_ma1sd_container_labels_matrix_client_user_directory_search_traefik_tls | to_json }}
{% if matrix_ma1sd_container_labels_matrix_client_user_directory_search_traefik_tls %}
traefik.http.routers.matrix-ma1sd-matrix-client-user-directory-search.tls.certResolver={{ matrix_ma1sd_container_labels_matrix_client_user_directory_search_traefik_tls_certResolver }}
{% endif %}
############################################################
# #
# /Matrix Client user-directory search API endpoint #
# (/_matrix/client/VERSION/user_directory/search) #
# #
############################################################
{% endif %}
{% if matrix_ma1sd_container_labels_matrix_client_user_directory_search_enabled %}
############################################################
# #
# Matrix Client 3pid registration API endpoint #
# (/_matrix/client/VERSION/register/TYPE/requestToken) #
# #
############################################################
# ma1sd only supports /_matrix/client/r0/register/TYPE/requestToken
# while we potentially handle /_matrix/client/v3/register/TYPE/requestToken as well,
# so we need to transparently reroute.
traefik.http.middlewares.matrix-ma1sd-matrix-client-3pid-registration-replacepathregex.replacepathregex.regex=^/_matrix/client/([^/]+)/register/([^/]+)/requestToken
traefik.http.middlewares.matrix-ma1sd-matrix-client-3pid-registration-replacepathregex.replacepathregex.replacement=/_matrix/client/r0/register/${2}/requestToken
traefik.http.routers.matrix-ma1sd-matrix-client-3pid-registration.rule={{ matrix_ma1sd_container_labels_matrix_client_3pid_registration_traefik_rule }}
traefik.http.routers.matrix-ma1sd-matrix-client-3pid-registration.middlewares=matrix-ma1sd-matrix-client-3pid-registration-replacepathregex
{% if matrix_ma1sd_container_labels_matrix_client_3pid_registration_traefik_priority | int > 0 %}
traefik.http.routers.matrix-ma1sd-matrix-client-3pid-registration.priority={{ matrix_ma1sd_container_labels_matrix_client_3pid_registration_traefik_priority }}
{% endif %}
traefik.http.routers.matrix-ma1sd-matrix-client-3pid-registration.service=matrix-ma1sd
traefik.http.routers.matrix-ma1sd-matrix-client-3pid-registration.entrypoints={{ matrix_ma1sd_container_labels_matrix_client_3pid_registration_traefik_entrypoints }}
traefik.http.routers.matrix-ma1sd-matrix-client-3pid-registration.tls={{ matrix_ma1sd_container_labels_matrix_client_3pid_registration_traefik_tls | to_json }}
{% if matrix_ma1sd_container_labels_matrix_client_3pid_registration_traefik_tls %}
traefik.http.routers.matrix-ma1sd-matrix-client-3pid-registration.tls.certResolver={{ matrix_ma1sd_container_labels_matrix_client_3pid_registration_traefik_tls_certResolver }}
{% endif %}
############################################################
# #
# /Matrix Client 3pid registration API endpoint #
# (/_matrix/client/VERSION/register/TYPE/requestToken) #
# #
############################################################
{% endif %}
{% endif %}
{{ matrix_ma1sd_container_labels_additional_labels }}