wait-for-pg-db

1.0.4 • Public • Published

Ensure connection and existence of a postgres database

Install: npm install -g wait-for-pg-db

This program is able to perform following operations:

  1. Waiting for a set of Kafka topics to become available
  2. 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 program
  • DEBUG="*" all debug outputs for this program and for kafka-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

Readme

Keywords

Package Sidebar

Install

npm i wait-for-pg-db

Weekly Downloads

0

Version

1.0.4

License

MIT

Unpacked Size

15.6 kB

Total Files

10

Last publish

Collaborators

  • azapps