Make hostname and consul discovery a bit more dynamic

This commit is contained in:
IamTheFij 2022-03-13 10:14:50 -07:00
parent 535dba941b
commit dc73e6427b

View File

@ -67,7 +67,7 @@ job "traefik" {
"--log.level=DEBUG", "--log.level=DEBUG",
"--entryPoints.web.address=:80", "--entryPoints.web.address=:80",
"--entryPoints.websecure.address=:443", "--entryPoints.websecure.address=:443",
# "--entryPoints.websecure.tls=true", "--entryPoints.websecure.tls=true",
"--entrypoints.web.http.redirections.entryPoint.to=websecure", "--entrypoints.web.http.redirections.entryPoint.to=websecure",
# "--entryPoints.admin.address=:8080", # "--entryPoints.admin.address=:8080",
"--accesslog=true", "--accesslog=true",
@ -84,9 +84,7 @@ job "traefik" {
"--providers.consulcatalog.connectbydefault=true", "--providers.consulcatalog.connectbydefault=true",
"--providers.consulcatalog.exposedbydefault=false", "--providers.consulcatalog.exposedbydefault=false",
"--providers.consulcatalog.endpoint.address=${var.consul_address}", "--providers.consulcatalog.endpoint.address=${var.consul_address}",
"--providers.consulcatalog.servicename=traefik", "--providers.consulcatalog.defaultrule=Host(`{{normalize .Name}}.${var.base_hostname}`)",
"--providers.consulcatalog.prefix=traefik",
"--providers.consulcatalog.defaultrule=Host(`{{normalize .Name}}.${var.base_hostname}`) || ({{hasKey .Labels \"subdomain\" }} && Host(`{{get .Labels \"subdomain\"}}.${var.base_hostname}`))",
] ]
ports = ["web", "websecure"] ports = ["web", "websecure"]