From 233277f7be894217ae9c3e781862804beb180fb7 Mon Sep 17 00:00:00 2001 From: Christophe Monniez Date: Mon, 9 Aug 2021 15:51:56 +0200 Subject: [PATCH] [IMP] Odoo 12.0-13.0: add support for docker secret In order to avoid postgresql password in an environment variable, a PASSWORD_FILE environment may be used instead. This allow the usage of secrets in docker-compose [0] [0](https://github.com/compose-spec/compose-spec/blob/master/spec.md#secrets) --- 12.0/entrypoint.sh | 4 ++++ 13.0/entrypoint.sh | 4 ++++ 14.0/entrypoint.sh | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/12.0/entrypoint.sh b/12.0/entrypoint.sh index 6dd42c4..f802bcb 100755 --- a/12.0/entrypoint.sh +++ b/12.0/entrypoint.sh @@ -2,6 +2,10 @@ set -e +if [ -v PASSWORD_FILE ]; then + PASSWORD="$(< $PASSWORD_FILE)" +fi + # set the postgres database host, port, user and password according to the environment # and pass them as arguments to the odoo process if not present in the config file : ${HOST:=${DB_PORT_5432_TCP_ADDR:='db'}} diff --git a/13.0/entrypoint.sh b/13.0/entrypoint.sh index 6dd42c4..f802bcb 100755 --- a/13.0/entrypoint.sh +++ b/13.0/entrypoint.sh @@ -2,6 +2,10 @@ set -e +if [ -v PASSWORD_FILE ]; then + PASSWORD="$(< $PASSWORD_FILE)" +fi + # set the postgres database host, port, user and password according to the environment # and pass them as arguments to the odoo process if not present in the config file : ${HOST:=${DB_PORT_5432_TCP_ADDR:='db'}} diff --git a/14.0/entrypoint.sh b/14.0/entrypoint.sh index 6dd42c4..f802bcb 100755 --- a/14.0/entrypoint.sh +++ b/14.0/entrypoint.sh @@ -2,6 +2,10 @@ set -e +if [ -v PASSWORD_FILE ]; then + PASSWORD="$(< $PASSWORD_FILE)" +fi + # set the postgres database host, port, user and password according to the environment # and pass them as arguments to the odoo process if not present in the config file : ${HOST:=${DB_PORT_5432_TCP_ADDR:='db'}}