From 4c7cc4d7ef365c067fcec7ed70ac1dcf9bda0144 Mon Sep 17 00:00:00 2001 From: Sameer Naik Date: Sun, 29 Nov 2015 23:31:20 +0530 Subject: [PATCH] define values for `DB_ADAPTER` and `DB_ENCODING` in `gitlab_finalize_database_parameters` --- assets/runtime/functions | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/assets/runtime/functions b/assets/runtime/functions index 9d337ff8..c49a14f3 100644 --- a/assets/runtime/functions +++ b/assets/runtime/functions @@ -84,8 +84,16 @@ gitlab_finalize_database_parameters() { # set default port number if not specified DB_TYPE=${DB_TYPE:-postgres} case ${DB_TYPE} in - mysql) DB_PORT=${DB_PORT:-3306} ;; - postgres) DB_PORT=${DB_PORT:-5432} ;; + mysql) + DB_ADAPTER=${DB_ADAPTER:-mysql2} + DB_ENCODING=${DB_ENCODING:-utf8} + DB_PORT=${DB_PORT:-3306} + ;; + postgres) + DB_ADAPTER=${DB_ADAPTER:-postgresql} + DB_ENCODING=${DB_ENCODING:-unicode} + DB_PORT=${DB_PORT:-5432} + ;; *) echo echo "ERROR: " @@ -132,24 +140,19 @@ gitlab_configure_database() { gitlab_finalize_database_parameters gitlab_check_database_connection + exec_as_git sed -i 's|{{DB_ADAPTER}}|'"${DB_ADAPTER}"'|' ${GITLAB_INSTALL_DIR}/config/database.yml + exec_as_git sed -i 's|{{DB_ENCODING}}|'"${DB_ENCODING}"'|' ${GITLAB_INSTALL_DIR}/config/database.yml exec_as_git sed -i 's|{{DB_HOST}}|'"${DB_HOST}"'|' ${GITLAB_INSTALL_DIR}/config/database.yml exec_as_git sed -i 's|{{DB_PORT}}|'"${DB_PORT}"'|' ${GITLAB_INSTALL_DIR}/config/database.yml exec_as_git sed -i 's|{{DB_NAME}}|'"${DB_NAME}"'|' ${GITLAB_INSTALL_DIR}/config/database.yml exec_as_git sed -i 's|{{DB_USER}}|'"${DB_USER}"'|' ${GITLAB_INSTALL_DIR}/config/database.yml exec_as_git sed -i 's|{{DB_PASS}}|'"${DB_PASS}"'|' ${GITLAB_INSTALL_DIR}/config/database.yml exec_as_git sed -i 's|{{DB_POOL}}|'"${DB_POOL}"'|' ${GITLAB_INSTALL_DIR}/config/database.yml - case ${DB_TYPE} in - postgres) - exec_as_git sed -i 's|{{DB_ADAPTER}}|postgresql|' ${GITLAB_INSTALL_DIR}/config/database.yml - exec_as_git sed -i 's|{{DB_ENCODING}}|unicode|' ${GITLAB_INSTALL_DIR}/config/database.yml - exec_as_git sed -i '/reconnect: /d' ${GITLAB_INSTALL_DIR}/config/database.yml - exec_as_git sed -i '/collation: /d' ${GITLAB_INSTALL_DIR}/config/database.yml - ;; - mysql) - exec_as_git sed -i 's|{{DB_ADAPTER}}|mysql2|' ${GITLAB_INSTALL_DIR}/config/database.yml - exec_as_git sed -i 's|{{DB_ENCODING}}|utf8|' ${GITLAB_INSTALL_DIR}/config/database.yml - ;; - esac + + if [[ ${DB_TYPE} == postgres ]]; then + exec_as_git sed -i '/reconnect: /d' ${GITLAB_INSTALL_DIR}/config/database.yml + exec_as_git sed -i '/collation: /d' ${GITLAB_INSTALL_DIR}/config/database.yml + fi } gitlab_finalize_redis_parameters() {