Add SELF_EXTRA_DOMAINS
This commit is contained in:
parent
bfc1ffec89
commit
066262ce96
3 changed files with 34 additions and 2 deletions
|
|
@ -11,6 +11,10 @@ DEFAULT_DOMAIN=localhost.kwarc.info
|
|||
# If you want to change this, set an alternate domain name here.
|
||||
SELF_REDIRECT=
|
||||
|
||||
# By default, only the 'self' domain above is caught.
|
||||
# To catch additional domains, add them here (comma seperated)
|
||||
SELF_EXTRA_DOMAINS=
|
||||
|
||||
# You can override individual URLS in the homepage.
|
||||
# Do this by adding URLs (without trailing '/'s) into a JSON file
|
||||
SELF_OVERRIDES_FILE=/distillery/overrides.json
|
||||
|
|
|
|||
|
|
@ -58,6 +58,20 @@ function is_valid_domain() {
|
|||
fi;
|
||||
}
|
||||
|
||||
# 'is_valid_domains' is like is_valid_domain, but comma seperated.
|
||||
function is_valid_domains() {
|
||||
if [ -z "$1" ]; then
|
||||
return 1;
|
||||
fi
|
||||
IFS=',' read -ra domains <<< "$1"
|
||||
for domain in $domains; do
|
||||
if ! is_valid_domain "$domain"; then
|
||||
return 0;
|
||||
fi
|
||||
done
|
||||
return 1;
|
||||
}
|
||||
|
||||
# 'is_valid_number' checks if a value is a valid number.
|
||||
function is_valid_number() {
|
||||
if [[ "$1" =~ ^[1-9][0-9]*$ ]]; then
|
||||
|
|
@ -152,6 +166,20 @@ if ! is_valid_domain "$DEFAULT_DOMAIN"; then
|
|||
exit 1;
|
||||
fi
|
||||
|
||||
# The 'SELF_EXTRA_DOMAINS' variable must be a valid domain.
|
||||
if ! is_valid_domain "$SELF_EXTRA_DOMAINS"; then
|
||||
log_error "Variable 'SELF_EXTRA_DOMAINS' does not contain comma-separated domains. ";
|
||||
log_info "Please verify that it is set correctly in '.env'. ";
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
# set SELF_DOMAIN_SPEC to full list of domains
|
||||
SELF_DOMAIN_SPEC="$DEFAULT_DOMAIN"
|
||||
if [ -n "$SELF_EXTRA_DOMAINS" ]; then
|
||||
SELF_DOMAIN_SPEC="$DEFAULT_DOMAIN,$SELF_EXTRA_DOMAINS"
|
||||
fi
|
||||
|
||||
|
||||
# The 'CERTBOT_EMAIL' variable should either be empty or a valid email
|
||||
if [ -n "$CERTBOT_EMAIL" ]; then
|
||||
if ! is_valid_email "$CERTBOT_EMAIL"; then
|
||||
|
|
@ -175,7 +203,7 @@ if ! is_valid_number "$MAX_BACKUP_AGE"; then
|
|||
exit 1;
|
||||
fi
|
||||
|
||||
# The 'CERTBOT_EMAIL' variable should either be empty or a valid email
|
||||
# The 'SELF_REDIRECT' variable should either be empty or a valid redirect uri
|
||||
if [ -n "$SELF_REDIRECT" ]; then
|
||||
if ! is_valid_https_url "$SELF_REDIRECT"; then
|
||||
log_error "Variable 'SELF_REDIRECT' is not a valid url. ";
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ fi;
|
|||
|
||||
log_info " => Writing 'self' configuration file"
|
||||
load_template "docker-env/self" \
|
||||
"VIRTUAL_HOST" "${DEFAULT_DOMAIN}" \
|
||||
"VIRTUAL_HOST" "${SELF_DOMAIN_SPEC}" \
|
||||
"LETSENCRYPT_HOST" "${LETSENCRYPT_HOST}" \
|
||||
"LETSENCRYPT_EMAIL" "${LETSENCRYPT_EMAIL}" \
|
||||
"TARGET" "${SELF_REDIRECT}" \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue