Skip to content

Commit 638bba5

Browse files
committed
Remove s/mime email configs if not enabled
Signed-off-by: Pierre Belloy <p.belloy@axelor.com>
1 parent f8b92b0 commit 638bba5

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

assets/runtime/config/gitlabhq/gitlab.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ production: &base
7070
email_display_name: {{GITLAB_EMAIL_DISPLAY_NAME}}
7171
email_reply_to: {{GITLAB_EMAIL_REPLY_TO}}
7272
email_subject_suffix: '{{GITLAB_EMAIL_SUBJECT_SUFFIX}}'
73+
#start-email-smime
7374
email_smime:
7475
# Uncomment and set to true if you need to enable email S/MIME signing (default: false)
7576
enabled: {{GITLAB_EMAIL_SMIME_ENABLE}}
@@ -79,6 +80,7 @@ production: &base
7980
# S/MIME public certificate key in PEM format, will be attached to signed messages
8081
# Default is '.gitlab_smime_cert' relative to Rails.root (i.e. root of the GitLab app).
8182
cert_file: {{GITLAB_EMAIL_SMIME_CERT_FILE}}
83+
#end-email-smime
8284

8385
# Email server smtp settings are in config/initializers/smtp_settings.rb.sample
8486

assets/runtime/functions

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -350,10 +350,18 @@ gitlab_configure_mail_delivery() {
350350
GITLAB_EMAIL \
351351
GITLAB_EMAIL_DISPLAY_NAME \
352352
GITLAB_EMAIL_REPLY_TO \
353-
GITLAB_EMAIL_SUBJECT_SUFFIX \
354-
GITLAB_EMAIL_SMIME_ENABLE \
355-
GITLAB_EMAIL_SMIME_KEY_FILE \
356-
GITLAB_EMAIL_SMIME_CERT_FILE
353+
GITLAB_EMAIL_SUBJECT_SUFFIX
354+
355+
if [[ ${GITLAB_EMAIL_SMIME_ENABLE} == true ]]; then
356+
exec_as_git sed -i "/#start-email-smime/d" ${GITLAB_CONFIG}
357+
exec_as_git sed -i "/#end-email-smime/d" ${GITLAB_CONFIG}
358+
update_template ${GITLAB_CONFIG} \
359+
GITLAB_EMAIL_SMIME_ENABLE \
360+
GITLAB_EMAIL_SMIME_KEY_FILE \
361+
GITLAB_EMAIL_SMIME_CERT_FILE
362+
else
363+
exec_as_git sed -i "/#start-email-smime/,/#end-email-smime/d" ${GITLAB_CONFIG}
364+
fi
357365
}
358366

359367
gitlab_configure_mailroom() {

0 commit comments

Comments
 (0)