PostgreSQL Check

PostgreSQL Check

PostgreSQL Check validates connectivity to a PostgreSQL database and optionally checks for SSL mode and database availability.

Usage with Binary

./wait4it -type=postgres -h=127.0.0.1 -p=5432 -t=60 -u=postgres -P=secret -ssl=disable

Usage with Docker

docker run ph4r5h4d/wait4it -type=postgres -h=127.0.0.1 -p=5432 -t=60 -u=postgres -P=secret -ssl=disable

Environment Variables

VariableDescriptionDefault
W4IT_TYPEThe type of check (set to postgres for PostgreSQL check).-
W4IT_TIMEOUTTimeout in seconds.30
W4IT_HOSTThe host to check.127.0.0.1
W4IT_PORTThe port to check on the PostgreSQL host.5432
W4IT_USERNAMEThe username for PostgreSQL authentication.-
W4IT_PASSWORDThe password for PostgreSQL authentication.-
W4IT_DBNAMEThe name of the database to check.-
W4IT_SSL_MODEWhether to enable or disable SSL mode for PostgreSQL (enable or disable).disable

Command-Line Arguments

ArgumentDescriptionDefault
-typeThe type of check (set to postgres).-
-tTimeout in seconds.30
-hThe host to check.127.0.0.1
-pThe port to check on the PostgreSQL host.5432
-uThe username for PostgreSQL authentication.-
-PThe password for PostgreSQL authentication.-
-nThe name of the database to check.-
-sslWhether to enable or disable SSL mode for PostgreSQL (disable or enable).disable

Notes

ℹ️
  • Environment variables override command-line arguments.
  • If W4IT_SSL_MODE is not defined, SSL is disabled by default.
  • Ensure that the specified PostgreSQL database, username, and password are correct for the connection to succeed.

Exit Codes

CodeMeaning
0Connection successful.
1Timed out.
2Validation error or incorrect input.