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

Support for gn_db env variable added #3

Open
wants to merge 4 commits into
base: main
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
8 changes: 5 additions & 3 deletions 3.2.1/postgres/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ if [ "$1" = 'catalina.sh' ]; then
exit 1
fi

db_admin="admin"
db_gn="geonetwork"
#Setting database name, otherwise use "geonetwork" as default
if [ -z "$db_gn" ]; then
db_gn="geonetwork"
fi

#Create databases, if they do not exist yet (http://stackoverflow.com/a/36591842/433558)
echo "$db_host:$db_port:*:$POSTGRES_DB_USERNAME:$POSTGRES_DB_PASSWORD" > ~/.pgpass
chmod 0600 ~/.pgpass
for db_name in "$db_admin" "$db_gn"; do
for db_name in "$db_gn"; do
if psql -h "$db_host" -U "$POSTGRES_DB_USERNAME" -p "$db_port" -tqc "SELECT 1 FROM pg_database WHERE datname = '$db_name'" | grep -q 1; then
echo "database '$db_name' exists; skipping createdb"
else
Expand Down