Add domains:set and domains:set-global commands
This commit is contained in:
@@ -85,7 +85,7 @@ domains_add() {
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ "$(is_app_vhost_enabled "$APP")" == "false" ]];then
|
||||
if [[ "$(is_app_vhost_enabled "$APP")" == "false" ]]; then
|
||||
domains_enable "$APP" --no-restart
|
||||
fi
|
||||
|
||||
@@ -105,12 +105,34 @@ domains_remove() {
|
||||
plugn trigger post-domains-update "$APP" "remove" "$@"
|
||||
}
|
||||
|
||||
domains_set() {
|
||||
declare desc="set list of domains for app"
|
||||
verify_app_name "$1"
|
||||
local APP="$1"; local APP_VHOST_PATH="$DOKKU_ROOT/$APP/VHOST"
|
||||
|
||||
shift 1
|
||||
for DOMAIN in "$@"; do
|
||||
if ! (is_valid_hostname "$DOMAIN"); then
|
||||
dokku_log_fail "$DOMAIN is invalid. exiting..."
|
||||
fi
|
||||
done
|
||||
|
||||
echo "$*" | tr " " "\n" > "$APP_VHOST_PATH"
|
||||
dokku_log_info1 "Set $* for $APP"
|
||||
|
||||
if [[ "$(is_app_vhost_enabled "$APP")" == "false" ]]; then
|
||||
domains_enable "$APP" --no-restart
|
||||
fi
|
||||
|
||||
plugn trigger post-domains-update "$APP" "set" "$@"
|
||||
}
|
||||
|
||||
domains_disable() {
|
||||
declare desc="disable domains/VHOST support"
|
||||
verify_app_name "$1"
|
||||
local APP="$1"; local APP_VHOST_PATH="$DOKKU_ROOT/$APP/VHOST"
|
||||
|
||||
if [[ "$(is_app_vhost_enabled "$APP")" == "true" ]];then
|
||||
if [[ "$(is_app_vhost_enabled "$APP")" == "true" ]]; then
|
||||
disable_app_vhost "$APP"
|
||||
else
|
||||
dokku_log_info1 "domains (VHOST) support is already disabled for app ($APP)"
|
||||
@@ -123,7 +145,7 @@ domains_enable() {
|
||||
local APP="$1"; local APP_VHOST_PATH="$DOKKU_ROOT/$APP/VHOST"
|
||||
local DEFAULT_VHOSTS="$(get_default_vhosts "$APP")"
|
||||
|
||||
if [[ "$(is_app_vhost_enabled "$APP")" == "false" ]];then
|
||||
if [[ "$(is_app_vhost_enabled "$APP")" == "false" ]]; then
|
||||
if [[ -n "$DEFAULT_VHOSTS" ]]; then
|
||||
echo "$DEFAULT_VHOSTS" > "$APP_VHOST_PATH"
|
||||
fi
|
||||
@@ -163,3 +185,17 @@ domains_remove_global() {
|
||||
dokku_log_info1 "Removed $DOMAIN"
|
||||
done
|
||||
}
|
||||
|
||||
domains_set_global() {
|
||||
declare desc="set list of global domains"
|
||||
local GLOBAL_VHOST_PATH="$DOKKU_ROOT/VHOST"
|
||||
|
||||
for DOMAIN in "$@"; do
|
||||
if ! (is_valid_hostname "$DOMAIN"); then
|
||||
dokku_log_fail "$DOMAIN is invalid. exiting..."
|
||||
fi
|
||||
done
|
||||
|
||||
echo "$*" | tr " " "\n" > "$GLOBAL_VHOST_PATH"
|
||||
dokku_log_info1 "Set $*"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user