feat: do not append the global domain for matching subdomains

If the subdomain is url-like, assume it is a valid url and use it for the default domain name. This allows users to specify the default domain for an app even if that is a subdomain of a global vhost.

Closes #3529
This commit is contained in:
Jose Diaz-Gonzalez
2019-05-12 07:36:02 -04:00
parent 948d507909
commit b429af8ff2
4 changed files with 24 additions and 16 deletions

View File

@@ -249,7 +249,7 @@ get_default_vhosts() {
local SUBDOMAIN=${APP/%\.${VHOST}/}
local hostname=$(: | plugn trigger nginx-hostname "$APP" "$SUBDOMAIN" "$VHOST")
if [[ -z $hostname ]]; then
if [[ "$APP" == *.* ]] && [[ "$SUBDOMAIN" == "$APP" ]]; then
if [[ "$APP" == *.* ]]; then
local hostname="${APP/\//-}"
else
local hostname="${APP/\//-}.$VHOST"

View File

@@ -44,13 +44,13 @@ cmd-domains-report-single() {
verify_app_name "$APP"
app_flags=(
"--domains-app-enabled: $(fn-domains-app-enabled "$APP")"
"--domains-app-vhosts: $(fn-domains-app-vhosts "$APP")"
"--domains-app-vhosts: $(fn-domains-app-vhosts "$APP" | awk '{$1=$1};1')"
)
fi
global_flags=(
"--domains-global-enabled: $(fn-domains-global-enabled)"
"--domains-global-vhosts: $(fn-domains-global-vhosts)"
"--domains-global-vhosts: $(fn-domains-global-vhosts | awk '{$1=$1};1')"
)
flag_map=("${app_flags[@]}" "${global_flags[@]}")