feat: add ability to set a custom priority for traefik routing rules
This commit is contained in:
@@ -44,6 +44,7 @@ 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-priority: $(fn-traefik-priority "$APP")"
|
||||
)
|
||||
|
||||
if [[ -z "$INFO_FLAG" ]]; then
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/traefik-vhosts/internal-functions"
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
@@ -81,7 +82,10 @@ trigger-traefik-vhosts-docker-args-process-deploy() {
|
||||
traefik_domains="${traefik_domains// /\\\`,\\\`}"
|
||||
fi
|
||||
|
||||
priority="$(date +%s)"
|
||||
priority="$(fn-traefik-priority "$APP")"
|
||||
if [[ -z "$priority" ]]; then
|
||||
priority="$(date +%s)"
|
||||
fi
|
||||
|
||||
output="--label traefik.enable=true"
|
||||
if [[ -n "$proxy_container_http_port" ]] || [[ -n "$proxy_container_http_port_candidate" ]]; then
|
||||
|
||||
@@ -92,3 +92,8 @@ fn-traefik-log-level() {
|
||||
log_level="$(fn-plugin-property-get-default "traefik" "--global" "log-level" "ERROR")"
|
||||
echo "${log_level^^}"
|
||||
}
|
||||
|
||||
fn-traefik-priority() {
|
||||
declare APP="$1"
|
||||
fn-plugin-property-get-default "traefik" "$APP" "priority" ""
|
||||
}
|
||||
|
||||
14
plugins/traefik-vhosts/post-delete
Executable file
14
plugins/traefik-vhosts/post-delete
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/property-functions"
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
trigger-traefik-vhosts-post-delete() {
|
||||
declare desc="traefik-vhosts post-delete trigger"
|
||||
declare trigger="post-delete"
|
||||
declare APP="$1"
|
||||
|
||||
fn-plugin-property-destroy "traefik" "$APP"
|
||||
}
|
||||
|
||||
trigger-traefik-vhosts-post-delete "$@"
|
||||
@@ -9,13 +9,13 @@ 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" "log-level")
|
||||
local GLOBAL_KEYS=("api-enabled" "api-vhost" "dashboard"-enabled "basic-auth-username" "basic-auth-password" "image" "letsencrypt-email" "log-level")
|
||||
local VALID_KEYS=("api-enabled" "api-vhost" "dashboard-enabled" "basic-auth-username" "basic-auth-password" "image" "letsencrypt-email" "letsencrypt-server" "log-level" "priority")
|
||||
local GLOBAL_KEYS=("api-enabled" "api-vhost" "dashboard"-enabled "basic-auth-username" "basic-auth-password" "image" "letsencrypt-email" "letsencrypt-server" "log-level")
|
||||
|
||||
[[ -z "$KEY" ]] && dokku_log_fail "No key specified"
|
||||
|
||||
if ! fn-in-array "$KEY" "${VALID_KEYS[@]}"; then
|
||||
dokku_log_fail "Invalid key specified, valid keys include: api-enabled api-vhost dashboard-enabled basic-auth-username basic-auth-password image letsencrypt-email log-level"
|
||||
dokku_log_fail "Invalid key specified, valid keys include: api-enabled api-vhost dashboard-enabled basic-auth-username basic-auth-password image letsencrypt-email letsencrypt-server log-level priority"
|
||||
fi
|
||||
|
||||
if ! fn-in-array "$KEY" "${GLOBAL_KEYS[@]}"; then
|
||||
|
||||
Reference in New Issue
Block a user