wait-for-pg-db
v1.0.4
Published
Ensures that certain Postgres DB exist
Downloads
3
Readme
Ensure connection and existence of a postgres database
Install: 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
Configuration
Set following environment variables:
Connection variables as defined by libpq
Debug settings
DEBUG="showcase:*"
all debug outputs for this programDEBUG="*"
all debug outputs for this program and forkafka-node
unset DEBUG
no debug outputs
Retries
ABORT_AFTER_TRIES
(optional, default:10
): After how many checks should the program abort?WAIT_BETWEEN_TRIES_S
(optional, default: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.
Example calls
Wait for DB
export DEBUG="showcase:*"
export PGHOST=localhost
export PGPORT=5432
export PGDATABASE=mydb
wait-for-pg-db
Wait for DB and run script
export DEBUG="showcase:*"
export PGHOST=localhost
export PGPORT=5432
export PGDATABASE=mydb
export RUN_AFTER_CONNECT=./example.sql
wait-for-pg-db