Skip to content

Commit

Permalink
[DCK] Add all domains to external database connection
Browse files Browse the repository at this point in the history
  • Loading branch information
josep-tecnativa committed Oct 28, 2024
1 parent f3df4ad commit fddaf8a
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions _traefik3_paths_labels.yml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
{%- endif %}
{%- endmacro %}

{%- macro domains_rule_sni(domain_group) -%}
{%- for host in domain_group.hosts -%}
{%- macro domains_rule_sni(hosts) -%}
{%- for host in hosts -%}
HostSNI(`{{ host }}`)
{%- if not loop.last -%}
||
Expand Down Expand Up @@ -233,9 +233,13 @@
{%- endfor %}
{%- endif %}

{#- Apply rule to the first element in domain_groups_list #}
{%- set first_domain_group = domain_groups_list[0] %}
traefik.tcp.routers.{{ key }}-database.rule: {{ domains_rule_sni(first_domain_group) }}
{%- set ns_hosts = namespace(all_hosts=[]) %}
{%- for domain_group in domain_groups_list %}
{%- set ns_hosts.all_hosts = ns_hosts.all_hosts + domain_group.hosts %}
{%- endfor %}

traefik.tcp.routers.{{ key }}-database.rule: {{ domains_rule_sni(ns_hosts.all_hosts) }}

{#- Remember basic middlewares for this domain group #}
{%- set _ns = namespace(basic_middlewares=[]) -%}
{%- if cidr_whitelist %}
Expand Down

0 comments on commit fddaf8a

Please sign in to comment.