Browse Source

new: [apache] default value for domain name is service name if this one is a domain name.

framadate
Valentin Lab 6 years ago
parent
commit
cee40ae5b4
  1. 24
      apache/lib/common

24
apache/lib/common

@ -2,11 +2,22 @@
config_hash= config_hash=
get_domain () {
relation-get domain 2>/dev/null && return 0
## is service name a regex ?
if [[ "$BASE_SERVICE_NAME" =~ ^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$ ]]; then
echo "$BASE_SERVICE_NAME"
return 0
fi
err "You must specify a ${WHITE}domain$NORMAL option in relation."
return 1
}
apache_proxy_dir () { apache_proxy_dir () {
DOMAIN=$(relation-get domain) || {
err "You must specify a ${WHITE}domain$NORMAL option in relation."
return 1
}
DOMAIN=$(get_domain) || return 1
proxy=yes apache_vhost_create || return 1 proxy=yes apache_vhost_create || return 1
info "Added $DOMAIN as a proxy to $TARGET." info "Added $DOMAIN as a proxy to $TARGET."
} }
@ -14,10 +25,7 @@ export -f apache_proxy_dir
apache_publish_dir () { apache_publish_dir () {
DOMAIN=$(relation-get domain) || {
err "You must specify a ${WHITE}domain$NORMAL option in relation."
return 1
}
DOMAIN=$(get_domain) || return 1
DOCKER_SITE_PATH="/var/www/${DOMAIN}" DOCKER_SITE_PATH="/var/www/${DOMAIN}"
LOCATION=$(relation-get location 2>/dev/null) || LOCATION=$(relation-get location 2>/dev/null) ||
LOCATION="$DATASTORE/$BASE_SERVICE_NAME$DOCKER_SITE_PATH" LOCATION="$DATASTORE/$BASE_SERVICE_NAME$DOCKER_SITE_PATH"

Loading…
Cancel
Save