Skip to content

Commit

Permalink
Update entrypoint to use new var
Browse files Browse the repository at this point in the history
  • Loading branch information
thatnerdjosh committed Mar 31, 2024
1 parent 5740583 commit fb45459
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 4 deletions.
11 changes: 10 additions & 1 deletion 15.0/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@ fi
# and pass them as arguments to the odoo process if not present in the config file
: ${HOST:=${DB_PORT_5432_TCP_ADDR:='db'}}
: ${PORT:=${DB_PORT_5432_TCP_PORT:=5432}}
: ${NAME:=${DB_ENV_POSTGRES_NAME:=${POSTGRES_NAME:='postgres'}}}
: ${USER:=${DB_ENV_POSTGRES_USER:=${POSTGRES_USER:='odoo'}}}
: ${PASSWORD:=${DB_ENV_POSTGRES_PASSWORD:=${POSTGRES_PASSWORD:='odoo'}}}
: ${SEED:=${DB_ENV_SEED:=false}}

DB_ARGS=()
ODOO_ARGS=()
function check_config() {
param="$1"
value="$2"
Expand All @@ -23,19 +26,25 @@ function check_config() {
DB_ARGS+=("--${param}")
DB_ARGS+=("${value}")
}

check_config "db_name" "$NAME"
check_config "db_host" "$HOST"
check_config "db_port" "$PORT"
check_config "db_user" "$USER"
check_config "db_password" "$PASSWORD"

if "$SEED" ; then
ODOO_ARGS+=("-i base")
fi

case "$1" in
-- | odoo)
shift
if [[ "$1" == "scaffold" ]] ; then
exec odoo "$@"
else
wait-for-psql.py ${DB_ARGS[@]} --timeout=30
exec odoo "$@" "${DB_ARGS[@]}"
exec odoo "$@" "${DB_ARGS[@]}" "${ODOO_ARGS[@]}"
fi
;;
-*)
Expand Down
11 changes: 10 additions & 1 deletion 16.0/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@ fi
# and pass them as arguments to the odoo process if not present in the config file
: ${HOST:=${DB_PORT_5432_TCP_ADDR:='db'}}
: ${PORT:=${DB_PORT_5432_TCP_PORT:=5432}}
: ${NAME:=${DB_ENV_POSTGRES_NAME:=${POSTGRES_NAME:='postgres'}}}
: ${USER:=${DB_ENV_POSTGRES_USER:=${POSTGRES_USER:='odoo'}}}
: ${PASSWORD:=${DB_ENV_POSTGRES_PASSWORD:=${POSTGRES_PASSWORD:='odoo'}}}
: ${SEED:=${DB_ENV_SEED:=false}}

DB_ARGS=()
ODOO_ARGS=()
function check_config() {
param="$1"
value="$2"
Expand All @@ -23,19 +26,25 @@ function check_config() {
DB_ARGS+=("--${param}")
DB_ARGS+=("${value}")
}

check_config "db_name" "$NAME"
check_config "db_host" "$HOST"
check_config "db_port" "$PORT"
check_config "db_user" "$USER"
check_config "db_password" "$PASSWORD"

if "$SEED" ; then
ODOO_ARGS+=("-i base")
fi

case "$1" in
-- | odoo)
shift
if [[ "$1" == "scaffold" ]] ; then
exec odoo "$@"
else
wait-for-psql.py ${DB_ARGS[@]} --timeout=30
exec odoo "$@" "${DB_ARGS[@]}"
exec odoo "$@" "${DB_ARGS[@]}" "${ODOO_ARGS[@]}"
fi
;;
-*)
Expand Down
13 changes: 11 additions & 2 deletions 17.0/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@ fi
# and pass them as arguments to the odoo process if not present in the config file
: ${HOST:=${DB_PORT_5432_TCP_ADDR:='db'}}
: ${PORT:=${DB_PORT_5432_TCP_PORT:=5432}}
: ${NAME:=${DB_ENV_POSTGRES_NAME:=${POSTGRES_NAME:='postgres'}}}
: ${USER:=${DB_ENV_POSTGRES_USER:=${POSTGRES_USER:='odoo'}}}
: ${PASSWORD:=${DB_ENV_POSTGRES_PASSWORD:=${POSTGRES_PASSWORD:='odoo'}}}
: ${SEED:=${DB_ENV_SEED:=false}}

DB_ARGS=()
ODOO_ARGS=()
function check_config() {
param="$1"
value="$2"
Expand All @@ -23,19 +26,25 @@ function check_config() {
DB_ARGS+=("--${param}")
DB_ARGS+=("${value}")
}

check_config "db_name" "$NAME"
check_config "db_host" "$HOST"
check_config "db_port" "$PORT"
check_config "db_user" "$USER"
check_config "db_password" "$PASSWORD"

if "$SEED" ; then
ODOO_ARGS+=("-i base")
fi

case "$1" in
-- | odoo)
shift
if [[ "$1" == "scaffold" ]] ; then
exec odoo "$@"
else
wait-for-psql.py ${DB_ARGS[@]} --timeout=30
exec odoo "$@" "${DB_ARGS[@]}"
exec odoo "$@" "${DB_ARGS[@]}" "${ODOO_ARGS[@]}"
fi
;;
-*)
Expand All @@ -46,4 +55,4 @@ case "$1" in
exec "$@"
esac

exit 1
exit 1

0 comments on commit fb45459

Please sign in to comment.