static_websites: Allow setting a custom certresolver per website

This patch will allow specifying a specific certresolver for a website and will otherwise choose the default as defined by the respective variable.
This commit is contained in:
saibotk 2020-08-14 05:22:23 +02:00
parent dc95ba9fb4
commit f429c43fe6
No known key found for this signature in database
GPG key ID: A3299C587D5DF523
2 changed files with 4 additions and 3 deletions

View file

@ -21,14 +21,15 @@
# The install location (where to put the docker-compose.yml)
static_websites_install_location: /srv/static_websites
# The certresolver to use by traefik for this domain
static_websites_traefik_certresolver: letsencrypt_http
# The default certresolver to use by traefik for the domain if none is specified
static_websites_default_traefik_certresolver: letsencrypt_http
# List of all static websites that should be deployed
# Available fields:
# WEBSITENAME: - The name of the website/entry
# image - docker image, can include a tag
# domain - domain that is published by traefik
# certresolver - specify traefik cert resolver (optional)
# hsts: - HSTS advanced settings (optional)
# preloaded - enable preloaded header
# subdomains - enable all subdomains header

View file

@ -42,7 +42,7 @@ services:
- "traefik.http.routers.static_websites_{{ key }}.rule=Host(`{{ value.domain }}`) && PathPrefix(`/`)"
- "traefik.http.routers.static_websites_{{ key }}.entrypoints=websecure"
- "traefik.http.routers.static_websites_{{ key }}.tls=true"
- "traefik.http.routers.static_websites_{{ key }}.tls.certresolver={{ static_websites_traefik_certresolver }}"
- "traefik.http.routers.static_websites_{{ key }}.tls.certresolver={{ value.certresolver | default(static_websites_default_traefik_certresolver) }}"
- "traefik.http.routers.static_websites_{{ key }}.middlewares=static_websites_{{ key }},compress"
- "traefik.http.middlewares.static_websites_{{ key }}.headers.sslredirect=true"
- "traefik.http.middlewares.static_websites_{{ key }}.headers.stsSeconds=63072000"