From c22f1d33c80d42b903e254b50d872180f2a3e99f Mon Sep 17 00:00:00 2001 From: Gonzalo Gabriel Perez Date: Mon, 15 May 2017 11:54:15 -0300 Subject: [PATCH 1/3] environment variable for database name added --- 3.2.1/postgres/docker-entrypoint.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/3.2.1/postgres/docker-entrypoint.sh b/3.2.1/postgres/docker-entrypoint.sh index 8aba177..7c2a7f9 100755 --- a/3.2.1/postgres/docker-entrypoint.sh +++ b/3.2.1/postgres/docker-entrypoint.sh @@ -21,8 +21,12 @@ if [ "$1" = 'catalina.sh' ]; then exit 1 fi - db_admin="admin" - db_gn="geonetwork" + db_gn="$POSTGRES_DB" + + #Setting database name, otherwise use "geonetwork" as default + if [ -z "$POSTGRES_DB" ]; 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 From 20be8171997cd8e861c267d971f96ab50b79ec2c Mon Sep 17 00:00:00 2001 From: Gonzalo Gabriel Perez Date: Fri, 19 May 2017 14:46:14 -0300 Subject: [PATCH 2/3] Support for gn_db env variable, if isn't present 'geonetwork' is used as default --- 3.2.1/postgres/docker-entrypoint.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/3.2.1/postgres/docker-entrypoint.sh b/3.2.1/postgres/docker-entrypoint.sh index 7c2a7f9..7489a25 100755 --- a/3.2.1/postgres/docker-entrypoint.sh +++ b/3.2.1/postgres/docker-entrypoint.sh @@ -21,17 +21,17 @@ if [ "$1" = 'catalina.sh' ]; then exit 1 fi - db_gn="$POSTGRES_DB" + # db_admin="admin" #Setting database name, otherwise use "geonetwork" as default - if [ -z "$POSTGRES_DB" ]; then + 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 From fd374292dda98f7db523fb95d35093f18a4cef0a Mon Sep 17 00:00:00 2001 From: Gonzalo Gabriel Perez Date: Fri, 19 May 2017 14:49:39 -0300 Subject: [PATCH 3/3] Support for gn_db env variable added, if isn't present 'geonetwork' is used as default. db_admin variable deleted --- 3.2.1/postgres/docker-entrypoint.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/3.2.1/postgres/docker-entrypoint.sh b/3.2.1/postgres/docker-entrypoint.sh index 7489a25..5ae6914 100755 --- a/3.2.1/postgres/docker-entrypoint.sh +++ b/3.2.1/postgres/docker-entrypoint.sh @@ -21,8 +21,6 @@ if [ "$1" = 'catalina.sh' ]; then exit 1 fi - # db_admin="admin" - #Setting database name, otherwise use "geonetwork" as default if [ -z "$db_gn" ]; then db_gn="geonetwork"