Automatically escape & characters from GITLAB_TIMEZONE parameter

Refer #499 #428 #342
Closes #390
This commit is contained in:
Sameer Naik 2015-11-22 12:06:56 +05:30
parent b5770c653f
commit c108bc7c48

View File

@ -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