|
@ -0,0 +1,38 @@ |
|
|
|
|
|
#!/bin/bash |
|
|
|
|
|
|
|
|
|
|
|
set -e |
|
|
|
|
|
|
|
|
|
|
|
## bug: https://github.com/adoptium/containers/issues/215#issuecomment-1142046045 |
|
|
|
|
|
docker_version=$(docker info --format '{{.ServerVersion}}') |
|
|
|
|
|
if ! version_gt "$docker_version" 20.10.0; then |
|
|
|
|
|
err "Sorry, $SERVICE_NAME require docker version >= 20.10 (current: $docker_version)" |
|
|
|
|
|
exit 1 |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PASSWORD_FILE="$SERVICE_DATASTORE"/secret-password |
|
|
|
|
|
|
|
|
|
|
|
if ! [ -f "$PASSWORD_FILE" ]; then |
|
|
|
|
|
info "Generating secret password" |
|
|
|
|
|
mkdir -p "${PASSWORD_FILE%/*}" |
|
|
|
|
|
umask 077 |
|
|
|
|
|
openssl rand -base64 32 > "$PASSWORD_FILE" |
|
|
|
|
|
else |
|
|
|
|
|
info "Using existing secret password" |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
secret_password=$(cat "$PASSWORD_FILE") |
|
|
|
|
|
support_email=$(options-get support-email) |
|
|
|
|
|
allowed_emails=$(options-get allowed-emails "") || true |
|
|
|
|
|
|
|
|
|
|
|
if [ -z "$allowed_emails" ]; then |
|
|
|
|
|
allowed_emails="*" |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
init-config-add "\ |
|
|
|
|
|
$MASTER_BASE_SERVICE_NAME: |
|
|
|
|
|
environment: |
|
|
|
|
|
SECRET_PASSWORD: \"$secret_password\" |
|
|
|
|
|
SUPPORT_EMAIL: \"$support_email\" |
|
|
|
|
|
ALLOWED_EMAILS: \"$allowed_emails\" |
|
|
|
|
|
" |