Add condition to include .co.XX TLDs

This is best effort checking of domain names and creating the traefik
rules. These two checks should cover most of the use cases.
This commit is contained in:
Sudarshan Wadkar 2020-04-18 00:13:12 +05:30
parent ab93e28c88
commit 4021286be0
No known key found for this signature in database
GPG Key ID: 9B706731048923D9

View File

@ -26,9 +26,10 @@ certificatesResolvers:
entryPoint: web
http:
{%- set domain_dots = cookiecutter.domain_name.count('.') %}
routers:
web-router:
{%- if len(cookiecutter.domain_name.split('.')) == 2 %}
{%- if domain_dots == 1 or (domain_dots == 2 and '.co.' in cookiecutter.domain_name) %}
rule: "Host(`{{ cookiecutter.domain_name }}`) || Host(`www.{{ cookiecutter.domain_name }}`)"
{% else %}
rule: "Host(`{{ cookiecutter.domain_name }}`)"
@ -41,7 +42,7 @@ http:
service: django
web-secure-router:
{%- if len(cookiecutter.domain_name.split('.')) == 2 %}
{%- if domain_dots == 1 or (domain_dots == 2 and '.co.' in cookiecutter.domain_name) %}
rule: "Host(`{{ cookiecutter.domain_name }}`) || Host(`www.{{ cookiecutter.domain_name }}`)"
{% else %}
rule: "Host(`{{ cookiecutter.domain_name }}`)"