Enable email notification for the gitlab, if the SMTP configuration is available
@@ -65,6 +65,29 @@ GIT_PROXIES="gitlab_rails['env'] = {
\"https_proxy\" => \"$CP_GITLAB_HTTPS_PROXY\"
}"
+# If the smtp configuration is available - add it to gitlab as well
+if [ "$CP_NOTIFIER_SMTP_FROM" ] && \
+ [ "$CP_NOTIFIER_SMTP_PASS" ] && \
+ [ "$CP_NOTIFIER_SMTP_SERVER_HOST" ] && \
+ [ "$CP_NOTIFIER_SMTP_SERVER_PORT" ] && \
+ [ "$CP_NOTIFIER_SMTP_USER" ]; then
+ echo
+ echo "SMTP configuration available:"
+ echo " Host: ${CP_NOTIFIER_SMTP_SERVER_HOST}:${CP_NOTIFIER_SMTP_SERVER_PORT}"
+ echo " User: $CP_NOTIFIER_SMTP_USER"
+ echo " From: $CP_NOTIFIER_SMTP_FROM"
+ echo
+ SMTP_SETTINGS="gitlab_rails['smtp_enable'] = true
+gitlab_rails['smtp_address'] = \"$CP_NOTIFIER_SMTP_SERVER_HOST\"
+gitlab_rails['smtp_port'] = $CP_NOTIFIER_SMTP_SERVER_PORT
+gitlab_rails['smtp_user_name'] = \"$CP_NOTIFIER_SMTP_USER\"
+gitlab_rails['smtp_password'] = \"$CP_NOTIFIER_SMTP_PASS\"
+gitlab_rails['smtp_domain'] = \"$CP_NOTIFIER_SMTP_SERVER_HOST\"
+gitlab_rails['smtp_authentication'] = \"login\"
+gitlab_rails['smtp_enable_starttls_auto'] = ${CP_NOTIFIER_SMTP_START_TLS:-false}
+gitlab_rails['gitlab_email_from'] = \"$CP_NOTIFIER_SMTP_FROM\""
+fi
+
cat >> /etc/gitlab/gitlab.rb <<-EOF
${GIT_PROXIES}
@@ -113,4 +136,6 @@ gitlab_rails['omniauth_providers'] = [
}
}
]
+
+${SMTP_SETTINGS}
EOF
