Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Override omero.db.name (fix #16) #17

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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}"
ROOTPASS="${ROOTPASS:-omero}"

Expand All @@ -40,6 +51,11 @@ psql -w -h "$DBHOST" -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
}