From 227a7adc955e5684c72b03e2f7911bf79206e081 Mon Sep 17 00:00:00 2001 From: Valentin Lab Date: Wed, 4 Dec 2019 14:20:04 +0100 Subject: [PATCH] new: [odoo-tecnativa] added 'database' option to charm. Not sure this one is a good idea. Signed-off-by: Valentin Lab --- .../hooks/postgres_database-relation-joined | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/odoo-tecnativa/hooks/postgres_database-relation-joined b/odoo-tecnativa/hooks/postgres_database-relation-joined index 3533ec9..ce5331a 100755 --- a/odoo-tecnativa/hooks/postgres_database-relation-joined +++ b/odoo-tecnativa/hooks/postgres_database-relation-joined @@ -22,23 +22,24 @@ ADMIN_PASSWORD=$(relation-base-compose-get admin-password 2>/dev/null) || { fi } - - control=$(echo -en "$USER\0$DBNAME\0$PASSWORD\0$ADMIN_PASSWORD" | md5_compat) +database=$(options-get database 2>/dev/null) || true +database="${database:-$DBNAME}" + config-add "\ services: $MASTER_BASE_SERVICE_NAME: command: - - '--database=$DBNAME' - ## All this is to please technativa image, but is quite redundant + - '--database=$database' + ## All this is to please tecnativa image, but is quite redundant environment: - PGHOST: $MASTER_TARGET_SERVICE_NAME - PGDATABASE: $DBNAME - PGPASSWORD: $PASSWORD - PGUSER: $USER + PGHOST: \"$MASTER_TARGET_SERVICE_NAME\" + PGDATABASE: \"$DBNAME\" + PGPASSWORD: \"$PASSWORD\" + PGUSER: \"$USER\" #DBFILTER: $DBNAME - ADMIN_PASSWORD: $ADMIN_PASSWORD + ADMIN_PASSWORD: \"$ADMIN_PASSWORD\" " [ "$control" == "$(relation-get control 2>/dev/null)" ] && exit 0