Commit 45b6bc22 authored by Dashamir Hoxha's avatar Dashamir Hoxha

Fix a couple of things and remove some dangling functions

parent 33cf3569
......@@ -9,8 +9,8 @@ _EOF
cmd_create() {
local nosystemd='false'
if [[ $1 == 'nosystemd' ]]; then
nosystemd='true'
shift
nosystemd='true'
shift
fi
# create a ds network if it does not yet exist
......@@ -33,19 +33,17 @@ cmd_create() {
"[email protected]" $IMAGE
# add DOMAIN to wsproxy
_add_domains_to_wsproxy
#### it is better to do it manually, so that letsencrypt rate limits are not reached
#### for more details see: https://letsencrypt.org/docs/rate-limits/
# # get a ssl cert from letsencrypt
# _get_ssl_cert_from_letsencrypt
if [[ -n $DOMAIN ]]; then
ds wsproxy add
ds wsproxy ssl-cert
fi
}
### Configure the host for running systemd containers.
### See: https://github.com/solita/docker-systemd/blob/master/setup
_systemd_config() {
local nosystemd='false'
[[ $nosystemd == 'true' ]] && return
local nosystemd=$1
[[ $nosystemd == 'true' ]] && echo '' && return
# configure the host for running systemd containers
if nsenter --mount=/proc/1/ns/mnt -- mount | grep /sys/fs/cgroup/systemd >/dev/null 2>&1; then
......@@ -88,46 +86,3 @@ _network_and_aliases() {
echo "$network"
}
### add DOMAIN and DOMAINS to wsproxy
_add_domains_to_wsproxy() {
[[ -z $DOMAIN ]] && return
local wsproxy=${WSPROXY:-wsproxy}
ds @$wsproxy domains-add $CONTAINER $DOMAIN $DOMAINS
}
### return 1 (false) if the domain is not a real one
### otherwise return 0 (true)
is_real_domain() {
local domain=$1
[[ -z $domain ]] && return 1
[[ $domain =~ ^(.*\.)?example\.org$ ]] && return 1
[[ $domain =~ ^(.*\.)?example\.com$ ]] && return 1
[[ $domain =~ \.local$ ]] && return 1
return 0
}
### return 1 (false) if the email is not a real one
### otherwise return 0 (true)
is_real_email() {
local email=$1
[[ -z $email ]] && return 1
[[ $email =~ \.example\.org$ ]] && return 1
[[ $email =~ \.example\.com$ ]] && return 1
return 0
}
### get a ssl cert from letsencrypt
_get_ssl_cert_from_letsencrypt() {
is_real_domain $DOMAIN || return
local email=${SSL_CERT_EMAIL:-${ADMIN_EMAIL:-$GMAIL_ADDRESS}}
is_real_email $email || return
ds @wsproxy get-ssl-cert $email $DOMAIN $DOMAINS
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment