Merge pull request #6808 from Coffee2CodeNL/traefik-custom-http-https-entrypoints

Traefik optional custom http https entrypoints
This commit is contained in:
Jose Diaz-Gonzalez
2024-04-27 09:34:00 -04:00
committed by GitHub
6 changed files with 87 additions and 4 deletions

View File

@@ -44,6 +44,8 @@ cmd-traefik-report-single() {
"--traefik-letsencrypt-email: $(fn-traefik-letsencrypt-email)"
"--traefik-letsencrypt-server: $(fn-traefik-letsencrypt-server)"
"--traefik-log-level: $(fn-traefik-log-level)"
"--traefik-http-entry-point: $(fn-traefik-http-entry-point)"
"--traefik-https-entry-point: $(fn-traefik-https-entry-point)"
)
if [[ -z "$INFO_FLAG" ]]; then

View File

@@ -96,7 +96,7 @@ trigger-traefik-vhosts-docker-args-process-deploy() {
fi
output="$output --label traefik.http.services.$APP-$PROC_TYPE-http.loadbalancer.server.port=$proxy_container_http_port"
output="$output --label traefik.http.routers.$APP-$PROC_TYPE-http.entrypoints=http"
output="$output --label traefik.http.routers.$APP-$PROC_TYPE-http.entrypoints=$(fn-traefik-http-entry-point)"
output="$output --label traefik.http.routers.$APP-$PROC_TYPE-http.service=$APP-$PROC_TYPE-http"
if [[ -n "$traefik_domains" ]]; then
output="$output --label \"traefik.http.routers.$APP-$PROC_TYPE-http.rule=Host(\\\`$traefik_domains\\\`)\""
@@ -111,7 +111,7 @@ trigger-traefik-vhosts-docker-args-process-deploy() {
fi
output="$output --label traefik.http.services.$APP-$PROC_TYPE-https.loadbalancer.server.port=$proxy_container_https_port"
output="$output --label traefik.http.routers.$APP-$PROC_TYPE-https.entrypoints=https"
output="$output --label traefik.http.routers.$APP-$PROC_TYPE-https.entrypoints=$(fn-traefik-https-entry-point)"
output="$output --label traefik.http.routers.$APP-$PROC_TYPE-https.service=$APP-$PROC_TYPE-https"
output="$output --label traefik.http.routers.$APP-$PROC_TYPE-https.tls.certresolver=leresolver"
if [[ -n "$traefik_domains" ]]; then

View File

@@ -92,3 +92,11 @@ fn-traefik-log-level() {
log_level="$(fn-plugin-property-get-default "traefik" "--global" "log-level" "ERROR")"
echo "${log_level^^}"
}
fn-traefik-http-entry-point() {
fn-plugin-property-get-default "traefik" "--global" "http-entry-point" "http"
}
fn-traefik-https-entry-point() {
fn-plugin-property-get-default "traefik" "--global" "https-entry-point" "https"
}

View File

@@ -9,8 +9,8 @@ cmd-traefik-set() {
declare cmd="traefik:set"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1" KEY="$2" VALUE="$3"
local VALID_KEYS=("api-enabled" "api-vhost" "dashboard-enabled" "basic-auth-username" "basic-auth-password" "image" "letsencrypt-email" "letsencrypt-server" "log-level")
local GLOBAL_KEYS=("api-enabled" "api-vhost" "dashboard"-enabled "basic-auth-username" "basic-auth-password" "image" "letsencrypt-email" "letsencrypt-server" "log-level")
local VALID_KEYS=("api-enabled" "api-vhost" "dashboard-enabled" "basic-auth-username" "basic-auth-password" "image" "letsencrypt-email" "letsencrypt-server" "log-level" "http-entry-point" "https-entry-point")
local GLOBAL_KEYS=("api-enabled" "api-vhost" "dashboard-enabled" "basic-auth-username" "basic-auth-password" "image" "letsencrypt-email" "letsencrypt-server" "log-level" "http-entry-point" "https-entry-point")
[[ -z "$KEY" ]] && dokku_log_fail "No key specified"