mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-07-12 17:12:25 +03:00
Conditionally add www host to traefik router
If the domain_name entered contains subdomains, e.g. `api.example.com` then do *not* add an additional `www.api.example.com` route to traefik If the user enters only the domain `example.com` then add the optional `www.example.com` Host to the traefik routers.
This commit is contained in:
parent
70e1220484
commit
cafc0ac1f3
|
@ -28,7 +28,11 @@ certificatesResolvers:
|
||||||
http:
|
http:
|
||||||
routers:
|
routers:
|
||||||
web-router:
|
web-router:
|
||||||
|
{%- if len(cookiecutter.domain_name.split('.')) == 2 %}
|
||||||
rule: "Host(`{{ cookiecutter.domain_name }}`) || Host(`www.{{ cookiecutter.domain_name }}`)"
|
rule: "Host(`{{ cookiecutter.domain_name }}`) || Host(`www.{{ cookiecutter.domain_name }}`)"
|
||||||
|
{% else %}
|
||||||
|
rule: "Host(`{{ cookiecutter.domain_name }}`)"
|
||||||
|
{%- endif %}
|
||||||
entryPoints:
|
entryPoints:
|
||||||
- web
|
- web
|
||||||
middlewares:
|
middlewares:
|
||||||
|
@ -37,7 +41,11 @@ http:
|
||||||
service: django
|
service: django
|
||||||
|
|
||||||
web-secure-router:
|
web-secure-router:
|
||||||
|
{%- if len(cookiecutter.domain_name.split('.')) == 2 %}
|
||||||
rule: "Host(`{{ cookiecutter.domain_name }}`) || Host(`www.{{ cookiecutter.domain_name }}`)"
|
rule: "Host(`{{ cookiecutter.domain_name }}`) || Host(`www.{{ cookiecutter.domain_name }}`)"
|
||||||
|
{% else %}
|
||||||
|
rule: "Host(`{{ cookiecutter.domain_name }}`)"
|
||||||
|
{%- endif %}
|
||||||
entryPoints:
|
entryPoints:
|
||||||
- web-secure
|
- web-secure
|
||||||
middlewares:
|
middlewares:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user