mirror of
https://github.com/dokku/dokku.git
synced 2025-12-29 00:25:08 +01:00
don't call nginx_build_config twice and make ip regex functions globally accessible
This commit is contained in:
@@ -360,3 +360,38 @@ dokku_auth() {
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
_ipv4_regex() {
|
||||
echo "([0-9]{1,3}[\.]){3}[0-9]{1,3}"
|
||||
}
|
||||
|
||||
_ipv6_regex() {
|
||||
local RE_IPV4="$(_ipv4_regex)"
|
||||
local RE_IPV6="([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|" # TEST: 1:2:3:4:5:6:7:8
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,7}:|" # TEST: 1:: 1:2:3:4:5:6:7::
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|" # TEST: 1::8 1:2:3:4:5:6::8 1:2:3:4:5:6::8
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|" # TEST: 1::7:8 1:2:3:4:5::7:8 1:2:3:4:5::8
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|" # TEST: 1::6:7:8 1:2:3:4::6:7:8 1:2:3:4::8
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|" # TEST: 1::5:6:7:8 1:2:3::5:6:7:8 1:2:3::8
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|" # TEST: 1::4:5:6:7:8 1:2::4:5:6:7:8 1:2::8
|
||||
RE_IPV6="${RE_IPV6}[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|" # TEST: 1::3:4:5:6:7:8 1::3:4:5:6:7:8 1::8
|
||||
RE_IPV6="${RE_IPV6}:((:[0-9a-fA-F]{1,4}){1,7}|:)|" # TEST: ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::
|
||||
RE_IPV6="${RE_IPV6}fe08:(:[0-9a-fA-F]{1,4}){2,2}%[0-9a-zA-Z]{1,}|" # TEST: fe08::7:8%eth0 fe08::7:8%1 (link-local IPv6 addresses with zone index)
|
||||
RE_IPV6="${RE_IPV6}::(ffff(:0{1,4}){0,1}:){0,1}${RE_IPV4}|" # TEST: ::255.255.255.255 ::ffff:255.255.255.255 ::ffff:0:255.255.255.255 (IPv4-mapped IPv6 addresses and IPv4-translated addresses)
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,4}:${RE_IPV4}" # TEST: 2001:db8:3:4::192.0.2.33 64:ff9b::192.0.2.33
|
||||
echo "$RE_IPV6"
|
||||
}
|
||||
|
||||
get_ipv4_regex() {
|
||||
local RE_IPV4="$(_ipv4_regex)"
|
||||
# Ensure the ip address continues to the end of the line
|
||||
# Fixes using a wildcard dns service such as xip.io which allows for *.<ip address>.xip.io
|
||||
echo "${RE_IPV4}\$"
|
||||
}
|
||||
|
||||
get_ipv6_regex() {
|
||||
local RE_IPV6="$(_ipv4_regex)"
|
||||
# Ensure the ip address continues to the end of the line
|
||||
# Fixes using a wildcard dns service such as xip.io which allows for *.<ip address>.xip.io
|
||||
echo "${RE_IPV6}\$"
|
||||
}
|
||||
|
||||
@@ -75,8 +75,6 @@ case "$1" in
|
||||
for DOMAIN in "$@"; do
|
||||
echo "$DOMAIN" >> "$DOKKU_ROOT/$APP/VHOST"
|
||||
done
|
||||
# we need to restart the app to make sure we're binding to the appropriate network interface
|
||||
nginx_build_config $APP
|
||||
plugn trigger post-domains-update $APP
|
||||
for DOMAIN in "$@"; do
|
||||
dokku_log_info1 "Added $DOMAIN to $APP"
|
||||
|
||||
@@ -3,7 +3,6 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$(dirname "$0")/functions"
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions"
|
||||
|
||||
case "$1" in
|
||||
logs)
|
||||
|
||||
@@ -5,41 +5,6 @@ source "$PLUGIN_AVAILABLE_PATH/certs/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/domains/functions"
|
||||
|
||||
_ipv4_regex() {
|
||||
echo "([0-9]{1,3}[\.]){3}[0-9]{1,3}"
|
||||
}
|
||||
|
||||
_ipv6_regex() {
|
||||
local RE_IPV4="$(_ipv4_regex)"
|
||||
local RE_IPV6="([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|" # TEST: 1:2:3:4:5:6:7:8
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,7}:|" # TEST: 1:: 1:2:3:4:5:6:7::
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|" # TEST: 1::8 1:2:3:4:5:6::8 1:2:3:4:5:6::8
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|" # TEST: 1::7:8 1:2:3:4:5::7:8 1:2:3:4:5::8
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|" # TEST: 1::6:7:8 1:2:3:4::6:7:8 1:2:3:4::8
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|" # TEST: 1::5:6:7:8 1:2:3::5:6:7:8 1:2:3::8
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|" # TEST: 1::4:5:6:7:8 1:2::4:5:6:7:8 1:2::8
|
||||
RE_IPV6="${RE_IPV6}[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|" # TEST: 1::3:4:5:6:7:8 1::3:4:5:6:7:8 1::8
|
||||
RE_IPV6="${RE_IPV6}:((:[0-9a-fA-F]{1,4}){1,7}|:)|" # TEST: ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::
|
||||
RE_IPV6="${RE_IPV6}fe08:(:[0-9a-fA-F]{1,4}){2,2}%[0-9a-zA-Z]{1,}|" # TEST: fe08::7:8%eth0 fe08::7:8%1 (link-local IPv6 addresses with zone index)
|
||||
RE_IPV6="${RE_IPV6}::(ffff(:0{1,4}){0,1}:){0,1}${RE_IPV4}|" # TEST: ::255.255.255.255 ::ffff:255.255.255.255 ::ffff:0:255.255.255.255 (IPv4-mapped IPv6 addresses and IPv4-translated addresses)
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,4}:${RE_IPV4}" # TEST: 2001:db8:3:4::192.0.2.33 64:ff9b::192.0.2.33
|
||||
echo "$RE_IPV6"
|
||||
}
|
||||
|
||||
get_ipv4_regex() {
|
||||
local RE_IPV4="$(_ipv4_regex)"
|
||||
# Ensure the ip address continues to the end of the line
|
||||
# Fixes using a wildcard dns service such as xip.io which allows for *.<ip address>.xip.io
|
||||
echo "${RE_IPV4}\$"
|
||||
}
|
||||
|
||||
get_ipv6_regex() {
|
||||
local RE_IPV6="$(_ipv4_regex)"
|
||||
# Ensure the ip address continues to the end of the line
|
||||
# Fixes using a wildcard dns service such as xip.io which allows for *.<ip address>.xip.io
|
||||
echo "${RE_IPV6}\$"
|
||||
}
|
||||
|
||||
is_app_nginx_enabled() {
|
||||
local APP="$1"
|
||||
verify_app_name "$APP"
|
||||
|
||||
Reference in New Issue
Block a user