Merge 017dd1b113
into bb4cc45844
This commit is contained in:
commit
3e08a1ef7c
@ -7,9 +7,31 @@ set -e
|
|||||||
: ${PORT:=${DB_PORT_5432_TCP_PORT:=5432}}
|
: ${PORT:=${DB_PORT_5432_TCP_PORT:=5432}}
|
||||||
: ${USER:=${DB_ENV_POSTGRES_USER:=${POSTGRES_USER:='odoo'}}}
|
: ${USER:=${DB_ENV_POSTGRES_USER:=${POSTGRES_USER:='odoo'}}}
|
||||||
: ${PASSWORD:=${DB_ENV_POSTGRES_PASSWORD:=${POSTGRES_PASSWORD:='odoo'}}}
|
: ${PASSWORD:=${DB_ENV_POSTGRES_PASSWORD:=${POSTGRES_PASSWORD:='odoo'}}}
|
||||||
# pass them as arguments to the odoo process
|
|
||||||
|
# pass them as arguments to the odoo process if not present in the config file
|
||||||
DB_ARGS=("--db_user" $USER "--db_password" $PASSWORD "--db_host" $HOST "--db_port" $PORT)
|
DB_ARGS=("--db_user" $USER "--db_password" $PASSWORD "--db_host" $HOST "--db_port" $PORT)
|
||||||
|
|
||||||
|
function is_in_config_file() {
|
||||||
|
if [[ ! -f ${ODOO_RC} ]] ; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
while read -r line ; do
|
||||||
|
if [[ ${line} == ${1}* ]] ; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
done < "${ODOO_RC}"
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
for i in "${!DB_ARGS[@]}" ; do
|
||||||
|
# postgres credentials begins by `--` when used as odoo argument but it's not the
|
||||||
|
# case when they're set in the config file
|
||||||
|
if [[ "${DB_ARGS[$i]}" == --* ]] && is_in_config_file "${DB_ARGS[$i]:2}" ; then
|
||||||
|
unset "DB_ARGS[$i]" ; unset "DB_ARGS[$i+1]"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
-- | odoo)
|
-- | odoo)
|
||||||
shift
|
shift
|
||||||
|
Loading…
Reference in New Issue
Block a user