Ensure connection and existence of a postgres database
npm install -g wait-for-pg-db
This program is able to perform following operations:
- Waiting for a set of Kafka topics to become available
- Creating new topics in the case they are not existent
Set following environment variables:
Connection variables as defined by libpq
DEBUG="showcase:*"all debug outputs for this program
DEBUG="*"all debug outputs for this program and for
unset DEBUGno debug outputs
10): After how many checks should the program abort?
5): How many seconds should the program wait before trying again?
Run SQL scripts
RUN_SQL_AFTER_CONNECT: comma separated list of SQL files that should be executed against the database after successfull connection.
Wait for DB
export DEBUG="showcase:*"export PGHOST=localhostexport PGPORT=5432export PGDATABASE=mydbwait-for-pg-db
Wait for DB and run script
export DEBUG="showcase:*"export PGHOST=localhostexport PGPORT=5432export PGDATABASE=mydbexport RUN_AFTER_CONNECT=./example.sqlwait-for-pg-db