You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
983 B

  1. #!/bin/bash
  2. set -e
  3. ## bug: https://github.com/adoptium/containers/issues/215#issuecomment-1142046045
  4. docker_version=$(docker info --format '{{.ServerVersion}}')
  5. if ! version_gt "$docker_version" 20.10.0; then
  6. err "Sorry, $SERVICE_NAME require docker version >= 20.10 (current: $docker_version)"
  7. exit 1
  8. fi
  9. PASSWORD_FILE="$SERVICE_DATASTORE"/secret-password
  10. if ! [ -f "$PASSWORD_FILE" ]; then
  11. info "Generating secret password"
  12. mkdir -p "${PASSWORD_FILE%/*}"
  13. umask 077
  14. openssl rand -base64 32 > "$PASSWORD_FILE"
  15. else
  16. info "Using existing secret password"
  17. fi
  18. secret_password=$(cat "$PASSWORD_FILE")
  19. support_email=$(options-get support-email)
  20. allowed_emails=$(options-get allowed-emails "") || true
  21. if [ -z "$allowed_emails" ]; then
  22. allowed_emails="*"
  23. fi
  24. init-config-add "\
  25. $MASTER_BASE_SERVICE_NAME:
  26. environment:
  27. SECRET_PASSWORD: \"$secret_password\"
  28. SUPPORT_EMAIL: \"$support_email\"
  29. ALLOWED_EMAILS: \"$allowed_emails\"
  30. "