don't create a user for hangarauth

Signed-off-by: MiniDigger <admin@minidigger.me>
This commit is contained in:
MiniDigger 2020-09-30 17:41:16 +02:00
parent 81b0f17114
commit 890b6ffbfc
2 changed files with 5 additions and 6 deletions

View File

@ -3,20 +3,19 @@
set -e
set -u
function create_user_and_database() {
function create_database() {
local database=$1
echo " Creating user and database '$database'"
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" <<-EOSQL
CREATE USER $database WITH PASSWORD '$database';
CREATE DATABASE $database;
GRANT ALL PRIVILEGES ON DATABASE $database TO $database;
GRANT ALL PRIVILEGES ON DATABASE $database TO $POSTGRES_USER;
EOSQL
}
if [ -n "$POSTGRES_MULTIPLE_DATABASES" ]; then
echo "Multiple database creation requested: $POSTGRES_MULTIPLE_DATABASES"
for db in $(echo $POSTGRES_MULTIPLE_DATABASES | tr ',' ' '); do
create_user_and_database $db
create_database $db
done
echo "Multiple databases created"
fi
fi

View File

@ -1,6 +1,6 @@
spring:
datasource:
url: jdbc:postgresql://db:5432/hangar
url: jdbc:postgresql://hangar_db:5432/hangar
username: hangar
password: hangar