Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IMP] Add option to customize wait-for-psql.py timeout #341

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions 12.0/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,23 @@ set -e
: ${PORT:=${DB_PORT_5432_TCP_PORT:=5432}}
: ${USER:=${DB_ENV_POSTGRES_USER:=${POSTGRES_USER:='odoo'}}}
: ${PASSWORD:=${DB_ENV_POSTGRES_PASSWORD:=${POSTGRES_PASSWORD:='odoo'}}}
: ${PSQL_TIMEOUT:=${DB_INIT_TIMEOUT:=30}}

DB_ARGS=()
function check_config() {
param="$1"
value="$2"
if grep -q -E "^\s*\b${param}\b\s*=" "$ODOO_RC" ; then
value=$(grep -E "^\s*\b${param}\b\s*=" "$ODOO_RC" |cut -d " " -f3|sed 's/["\n\r]//g')
fi;
if grep -q -E "^\s*\b${param}\b\s*=" "$ODOO_RC"; then
value=$(
grep -E "^\s*\b${param}\b\s*=" "$ODOO_RC" \
| cut -d " " -f3 \
| sed 's/["\n\r]//g'
)
fi
Copy link
Author

@mamiu mamiu Nov 28, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes are just editor code formatting.

DB_ARGS+=("--${param}")
DB_ARGS+=("${value}")
}

check_config "db_host" "$HOST"
check_config "db_port" "$PORT"
check_config "db_user" "$USER"
Expand All @@ -30,12 +36,12 @@ case "$1" in
if [[ "$1" == "scaffold" ]] ; then
exec odoo "$@"
else
wait-for-psql.py ${DB_ARGS[@]} --timeout=30
wait-for-psql.py ${DB_ARGS[@]} --timeout=$PSQL_TIMEOUT
exec odoo "$@" "${DB_ARGS[@]}"
fi
;;
-*)
wait-for-psql.py ${DB_ARGS[@]} --timeout=30
wait-for-psql.py ${DB_ARGS[@]} --timeout=$PSQL_TIMEOUT
exec odoo "$@" "${DB_ARGS[@]}"
;;
*)
Expand Down
16 changes: 11 additions & 5 deletions 13.0/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,23 @@ set -e
: ${PORT:=${DB_PORT_5432_TCP_PORT:=5432}}
: ${USER:=${DB_ENV_POSTGRES_USER:=${POSTGRES_USER:='odoo'}}}
: ${PASSWORD:=${DB_ENV_POSTGRES_PASSWORD:=${POSTGRES_PASSWORD:='odoo'}}}
: ${PSQL_TIMEOUT:=${DB_INIT_TIMEOUT:=30}}

DB_ARGS=()
function check_config() {
param="$1"
value="$2"
if grep -q -E "^\s*\b${param}\b\s*=" "$ODOO_RC" ; then
value=$(grep -E "^\s*\b${param}\b\s*=" "$ODOO_RC" |cut -d " " -f3|sed 's/["\n\r]//g')
fi;
if grep -q -E "^\s*\b${param}\b\s*=" "$ODOO_RC"; then
value=$(
grep -E "^\s*\b${param}\b\s*=" "$ODOO_RC" \
| cut -d " " -f3 \
| sed 's/["\n\r]//g'
)
fi
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again code formatting.

DB_ARGS+=("--${param}")
DB_ARGS+=("${value}")
}

check_config "db_host" "$HOST"
check_config "db_port" "$PORT"
check_config "db_user" "$USER"
Expand All @@ -30,12 +36,12 @@ case "$1" in
if [[ "$1" == "scaffold" ]] ; then
exec odoo "$@"
else
wait-for-psql.py ${DB_ARGS[@]} --timeout=30
wait-for-psql.py ${DB_ARGS[@]} --timeout=$PSQL_TIMEOUT
exec odoo "$@" "${DB_ARGS[@]}"
fi
;;
-*)
wait-for-psql.py ${DB_ARGS[@]} --timeout=30
wait-for-psql.py ${DB_ARGS[@]} --timeout=$PSQL_TIMEOUT
exec odoo "$@" "${DB_ARGS[@]}"
;;
*)
Expand Down
16 changes: 11 additions & 5 deletions 14.0/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,23 @@ set -e
: ${PORT:=${DB_PORT_5432_TCP_PORT:=5432}}
: ${USER:=${DB_ENV_POSTGRES_USER:=${POSTGRES_USER:='odoo'}}}
: ${PASSWORD:=${DB_ENV_POSTGRES_PASSWORD:=${POSTGRES_PASSWORD:='odoo'}}}
: ${PSQL_TIMEOUT:=${DB_INIT_TIMEOUT:=30}}

DB_ARGS=()
function check_config() {
param="$1"
value="$2"
if grep -q -E "^\s*\b${param}\b\s*=" "$ODOO_RC" ; then
value=$(grep -E "^\s*\b${param}\b\s*=" "$ODOO_RC" |cut -d " " -f3|sed 's/["\n\r]//g')
fi;
if grep -q -E "^\s*\b${param}\b\s*=" "$ODOO_RC"; then
value=$(
grep -E "^\s*\b${param}\b\s*=" "$ODOO_RC" \
| cut -d " " -f3 \
| sed 's/["\n\r]//g'
)
fi
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code formatting as well.

DB_ARGS+=("--${param}")
DB_ARGS+=("${value}")
}

check_config "db_host" "$HOST"
check_config "db_port" "$PORT"
check_config "db_user" "$USER"
Expand All @@ -30,12 +36,12 @@ case "$1" in
if [[ "$1" == "scaffold" ]] ; then
exec odoo "$@"
else
wait-for-psql.py ${DB_ARGS[@]} --timeout=30
wait-for-psql.py ${DB_ARGS[@]} --timeout=$PSQL_TIMEOUT
exec odoo "$@" "${DB_ARGS[@]}"
fi
;;
-*)
wait-for-psql.py ${DB_ARGS[@]} --timeout=30
wait-for-psql.py ${DB_ARGS[@]} --timeout=$PSQL_TIMEOUT
exec odoo "$@" "${DB_ARGS[@]}"
;;
*)
Expand Down