diff --git a/60-database.sh b/60-database.sh index 076c153a..7d4b2c9c 100755 --- a/60-database.sh +++ b/60-database.sh @@ -16,8 +16,17 @@ else DBHOST=db $omero config set omero.db.host "$DBHOST" fi + +CONFIG_omero_db_name=${CONFIG_omero_db_name:-} +if [ -n "$CONFIG_omero_db_name" ]; then + DBNAME="$CONFIG_omero_db_name" +else + DBNAME=omero + # Delay setting in config until *after* + # the upgrade is attempted. +fi + DBUSER="${CONFIG_omero_db_user:-omero}" -DBNAME="${CONFIG_omero_db_name:-omero}" DBPASS="${CONFIG_omero_db_pass:-omero}" ROOTPASS="${ROOTPASS:-omero}" @@ -40,6 +49,8 @@ psql -w -h "$DBHOST" -U "$DBUSER" "$DBNAME" -c \ echo "Upgrading database" $omego db upgrade --serverdir=OMERO.server } || { + $omero config set omero.db.host "$DBHOST" + $omero config set omero.db.name "$DBNAME" echo "Initialising database" $omego db init --rootpass "$ROOTPASS" --serverdir=OMERO.server }