Skip to content

Commit

Permalink
Move DB_SSL_MODE logic to finalize_database_parameters
Browse files Browse the repository at this point in the history
The main reason of this is for aws template.
We get the database configuration (and credentials) remotely.
So, at the time env-defaults is called, the adapter is not defined.
  • Loading branch information
abinoam committed Dec 4, 2024
1 parent d8526c7 commit 7cbdcf5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 0 additions & 10 deletions assets/runtime/env-defaults
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,6 @@ case ${DB_TYPE} in
sqlite3) DB_ADAPTER=${DB_ADAPTER:-sqlite3} ;;
esac

if [[ ! -z "${DB_SSL_MODE}" ]]
then
# Add sslmode or ssl_mode depending on type
case ${DB_ADAPTER} in
mysql2) DB_SSL_MODE="ssl_mode: ${DB_SSL_MODE}" ;;
postgresql) DB_SSL_MODE="sslmode: ${DB_SSL_MODE}" ;;
sqlite3) DB_SSL_MODE= ;; # No ssl
esac
fi

## UNICORN (deprecated)
UNICORN_WORKERS=${UNICORN_WORKERS:-2}
UNICORN_TIMEOUT=${UNICORN_TIMEOUT:-60}
Expand Down
10 changes: 10 additions & 0 deletions assets/runtime/functions
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,16 @@ redmine_finalize_database_parameters() {
;;
esac

if [[ ! -z "${DB_SSL_MODE}" ]]
then
# Add sslmode or ssl_mode depending on type
case ${DB_ADAPTER} in
mysql2) DB_SSL_MODE="ssl_mode: ${DB_SSL_MODE}" ;;
postgresql) DB_SSL_MODE="sslmode: ${DB_SSL_MODE}" ;;
sqlite3) DB_SSL_MODE= ;; # No ssl
esac
fi

# set default user and database
DB_USER=${DB_USER:-root}
DB_NAME=${DB_NAME:-redmine_production}
Expand Down

0 comments on commit 7cbdcf5

Please sign in to comment.