Skip to content

Commit

Permalink
Added an option to skip the database setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabien Dupont committed Oct 18, 2017
1 parent 2111b9d commit 53686b6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions content/opt/run
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ if [ ! -f "${initfile}" ]; then
RUNDECK_STORAGE_PROVIDER=${RUNDECK_STORAGE_PROVIDER:-"file"}
RUNDECK_PROJECT_STORAGE_TYPE=${RUNDECK_PROJECT_STORAGE_TYPE:-"file"}
NO_LOCAL_MYSQL=${NO_LOCAL_MYSQL:-"false"}
SKIP_DATABASE_SETUP=${SKIP_DATABASE_SETUP:-"false"}
LOGIN_MODULE=${LOGIN_MODULE:-"RDpropertyfilelogin"}
JAAS_CONF_FILE=${JAAS_CONF_FILE:-"jaas-loginmodule.conf"}
KEYSTORE_PASS=${KEYSTORE_PASS:-"adminadmin"}
Expand Down Expand Up @@ -125,7 +126,7 @@ if [ ! -f "${initfile}" ]; then
cat /opt/mysql.conf >> /etc/supervisor/conf.d/rundeck.conf
else
echo "=>NO_LOCAL_MYSQL set to true. Skipping local MySQL setup"
if [[ ${DATABASE_URL} == *"mysql"* ]]; then
if [[ "${DATABASE_URL}" == *"mysql"* && "${SKIP_DATABASE_SETUP}" != "true" ]]; then
echo "=>Initializing remote MySQL setup"
(
echo "CREATE DATABASE IF NOT EXISTS rundeckdb;"
Expand All @@ -134,7 +135,7 @@ if [ ! -f "${initfile}" ]; then
) |
mysql --host=$(echo ${DATABASE_URL} | grep -oP "(?<=jdbc:mysql:\/\/)(.*)(?=\/)") --user=${DATABASE_ADMIN_USER} --password=${DATABASE_ADMIN_PASSWORD}
else
echo "=>Remote database is not MySQL. Skipping remote setup"
echo "=>Skipping remote database setup"
fi
fi

Expand Down

0 comments on commit 53686b6

Please sign in to comment.