Make 'TARGET' configurable

This commit makes the TARGET of the self container redirect
configurable.
This commit is contained in:
Tom Wiesing 2020-07-10 10:21:30 +02:00
parent 2dfed350e0
commit 65a42f61e9
No known key found for this signature in database
GPG key ID: DC1F29F2BC78AB15
4 changed files with 29 additions and 1 deletions

View file

@ -7,11 +7,17 @@ DEPLOY_ROOT=/var/www/deploy
# This setting configures the default domain-name to create subdomains of.
DEFAULT_DOMAIN=localhost.kwarc.info
# By default, the default domain redirects to the distillery repository.
# If you want to change this, set an alternate domain name here.
SELF_REDIRECT=
# The system can support setting up certificate(s) automatically.
# It can be enabled by setting an email for certbot certificates.
# This email address can be configured here.
CERTBOT_EMAIL=
# Each Drupal instance requires a corresponding system user, database users and databases.
# These are also set by the appropriate domain name.
# To differentiate them from other users of the system, these names can be prefixed.

View file

@ -76,6 +76,15 @@ function is_valid_email() {
fi
}
# 'is_valid_https_url' checks if a value is a valid url that starts with https
function is_valid_https_url() {
if [[ "$1" =~ ^https:// ]]; then
return 0;
else
return 1;
fi
}
# The 'DEPLOY_ROOT' variable must be an absolute path.
if ! is_valid_abspath "$DEPLOY_ROOT"; then
log_error "Variable 'DEPLOY_ROOT' is missing or not a valid path. ";
@ -150,6 +159,18 @@ if ! is_valid_number "$PASSWORD_LENGTH"; then
exit 1;
fi
# The 'CERTBOT_EMAIL' variable should either be empty or a valid email
if [ -n "$SELF_REDIRECT" ]; then
if ! is_valid_https_url "$SELF_REDIRECT"; then
log_error "Variable 'SELF_REDIRECT' is not a valid url. ";
log_info "It should start with https://"
log_info "Please verify that it is set correctly in '.env' or remove it completly. ";
exit 1;
fi;
else
SELF_REDIRECT="https://gitlab.cs.fau.de/AGFD/wisski-distillery"
fi
# paths to composer things
DEPLOY_WEB_DIR="$DEPLOY_ROOT/core/web"
DEPLOY_SELF_DIR="$DEPLOY_ROOT/core/self"

View file

@ -3,4 +3,4 @@ VIRTUAL_HOST=${VIRTUAL_HOST}
LETSENCRYPT_HOST=${LETSENCRYPT_HOST}
LETSENCRYPT_EMAIL=${LETSENCRYPT_EMAIL}
TARGET=https://gitlab.cs.fau.de/AGFD/wisski-distillery
TARGET=${TARGET}

View file

@ -76,6 +76,7 @@ load_template "docker-env/self" \
"VIRTUAL_HOST" "${DEFAULT_DOMAIN}" \
"LETSENCRYPT_HOST" "${LETSENCRYPT_HOST}" \
"LETSENCRYPT_EMAIL" "${LETSENCRYPT_EMAIL}" \
"TARGET" "${SELF_REDIRECT}" \
> "$DEPLOY_SELF_DIR/.env"