From c108bc7c48f907befe7fe6ecebb7e77e503914a0 Mon Sep 17 00:00:00 2001 From: Sameer Naik Date: Sun, 22 Nov 2015 12:06:56 +0530 Subject: [PATCH] Automatically escape `&` characters from `GITLAB_TIMEZONE` parameter Refer #499 #428 #342 Closes #390 --- assets/runtime/functions | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/assets/runtime/functions b/assets/runtime/functions index 566b07f3..1b6b6125 100644 --- a/assets/runtime/functions +++ b/assets/runtime/functions @@ -215,6 +215,12 @@ gitlab_configure_unicorn() { exec_as_git sed -i 's/{{UNICORN_TIMEOUT}}/'"${UNICORN_TIMEOUT}"'/' ${GITLAB_INSTALL_DIR}/config/unicorn.rb } +gitlab_configure_timezone() { + echo "Configuring gitlab::timezone..." + GITLAB_TIMEZONE="$(echo "${GITLAB_TIMEZONE}" | sed 's/[\/&]/\\&/g')" + exec_as_git sed -i 's|{{GITLAB_TIMEZONE}}|'"${GITLAB_TIMEZONE}"'|' ${GITLAB_INSTALL_DIR}/config/gitlab.yml +} + gitlab_configure_mail_delivery() { if [[ ${SMTP_ENABLED} == true ]]; then echo "Configuring gitlab::smtp_settings..." @@ -869,7 +875,6 @@ configure_gitlab() { exec_as_git sed -i 's/{{GITLAB_MAX_SIZE}}/'"${GITLAB_MAX_SIZE}"'/' ${GITLAB_INSTALL_DIR}/config/gitlab.yml exec_as_git sed -i 's/{{GITLAB_SSH_HOST}}/'"${GITLAB_SSH_HOST}"'/' ${GITLAB_INSTALL_DIR}/config/gitlab.yml exec_as_git sed -i 's/{{GITLAB_SSH_PORT}}/'"${GITLAB_SSH_PORT}"'/' ${GITLAB_INSTALL_DIR}/config/gitlab.yml - exec_as_git sed -i 's/{{GITLAB_TIMEZONE}}/'"${GITLAB_TIMEZONE}"'/' ${GITLAB_INSTALL_DIR}/config/gitlab.yml exec_as_git sed -i 's/{{GITLAB_USERNAME_CHANGE}}/'"${GITLAB_USERNAME_CHANGE}"'/' ${GITLAB_INSTALL_DIR}/config/gitlab.yml exec_as_git sed -i 's/{{GITLAB_CREATE_GROUP}}/'"${GITLAB_CREATE_GROUP}"'/' ${GITLAB_INSTALL_DIR}/config/gitlab.yml exec_as_git sed -i 's/{{GITLAB_TIMEOUT}}/'"${GITLAB_TIMEOUT}"'/' ${GITLAB_INSTALL_DIR}/config/gitlab.yml @@ -879,6 +884,7 @@ configure_gitlab() { gitlab_configure_secrets gitlab_configure_sidekiq gitlab_configure_unicorn + gitlab_configure_timezone gitlab_configure_ci gitlab_configure_project_features gitlab_configure_mail_delivery