The code changes add the capability to configure custom HTTP and HTTPS entry points for the Traefik virtual hosts plugin. New settings have been added to the list of valid and global keys. Also, function definitions for retrieving default HTTP and HTTPS entry points were included in the internal functions file. Furthermore, the 'docker-args-process-deploy' script now considers the new entry points while processing deployment arguments. Also fixed a typo in set, line 13: "dashboard"-enabled -> "dashboard-enabled"
38 lines
1.5 KiB
Bash
Executable File
38 lines
1.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/property-functions"
|
|
set -eo pipefail
|
|
[[ $DOKKU_TRACE ]] && set -x
|
|
|
|
cmd-traefik-set() {
|
|
declare desc="set or clear an traefik property for an app"
|
|
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" "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"
|
|
|
|
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 letsencrypt-server log-level"
|
|
fi
|
|
|
|
if ! fn-in-array "$KEY" "${GLOBAL_KEYS[@]}"; then
|
|
if [[ "$APP" == "--global" ]]; then
|
|
dokku_log_fail "The key '$KEY' cannot be set globally"
|
|
fi
|
|
verify_app_name "$APP"
|
|
fi
|
|
|
|
if [[ -n "$VALUE" ]]; then
|
|
dokku_log_info2_quiet "Setting ${KEY} to ${VALUE}"
|
|
fn-plugin-property-write "traefik" "$APP" "$KEY" "$VALUE"
|
|
else
|
|
dokku_log_info2_quiet "Unsetting ${KEY}"
|
|
fn-plugin-property-delete "traefik" "$APP" "$KEY"
|
|
fi
|
|
}
|
|
|
|
cmd-traefik-set "$@"
|