Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@swarthy/wait-for

swarthy1.5kMIT2.1.1

Wait for (PostgresSQL|RabbitMQ|Redis) server is available

wait-for, postgres, postgresql, rabbit, rabbitmq, redis

readme

wait-for

npm Build Status

wait-for will try connect to server then exit with code 0 if server is available and 1 otherwise.

Usage

PostgreSQL

wait-for --postgresql postgres://postgres@localhost && npm run test-integration
# or
POSTGRESQL_URI=postgres://postgres@localhost wait-for --postgresql && npm run test-integration

RabbitMQ

wait-for --rabbitmq amqp://localhost && npm run test-integration
# or
RABBITMQ_URI=amqp://localhost wait-for --rabbitmq && npm run test-integration

Redis

wait-for --redis redis://localhost && npm run test-integration
# or
REDIS_URI=redis://localhost wait-for --redis && npm run test-integration

Example

Wait for PostgreSQL, RabbitMQ and Redis (configured via environment)

wait-for --postgresql --rabbitmq --redis && npm run test-integration

Configuration

CLI argument Environment variable Description Default
--postgressql POSTGRESQL_URI Connection string
--rabbitmq RABBITMQ_URI Connection string
--redis REDIS_URI Connection string
-c, --max-attempts | Max attempt count 60
-d, --delay | Delay between attempts 1000
-q, --quiet | Quiet mode

Used packages

amqplib pg redis