Skip to content

Commit

Permalink
merge master -Dorg -Snone: PR 17 (Override omero.db.name (fix ome#16))
Browse files Browse the repository at this point in the history
  • Loading branch information
snoopycrimecop committed Dec 8, 2022
2 parents 11f612e + da67654 commit a3a2124
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion 60-database.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,19 @@ 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"
DBNAME_src=env
else
# Delay setting in config until *after*
# the upgrade is attempted.
DBNAME=omero
DBNAME_src=default
fi

DBUSER="${CONFIG_omero_db_user:-omero}"
DBNAME="${CONFIG_omero_db_name:-omero}"
DBPASS="${CONFIG_omero_db_pass:-omero}"
DBPORT="${CONFIG_omero_db_port:-5432}"
ROOTPASS="${ROOTPASS:-omero}"
Expand All @@ -41,6 +52,11 @@ psql -w -h "$DBHOST" -p "$DBPORT" -U "$DBUSER" "$DBNAME" -c \
echo "Upgrading database"
$omego db upgrade --serverdir=OMERO.server
} || {
if [ "$DBNAME_src" = default ]; then
$omero config set omero.db.name "$DBNAME"
# And set for restarts
echo config set omero.db.name \"$DBNAME\" > /opt/omero/server/config/60-database.omero
fi
echo "Initialising database"
$omego db init --rootpass "$ROOTPASS" --serverdir=OMERO.server
}

0 comments on commit a3a2124

Please sign in to comment.