@collectai/node-waitfordb v0.2.1
node-waitfordb
Install
npm install @collectai/node-waitfordb
Run
The installer puts the scripts in the node_module/.bin folder, so those can be run from there:
node $(npm bin)/waitfordb
- wait for database (or database instance) to be created
node $(npm bin)/createdb
- create database(s) database instance
Parameters
Environment variables
POSTGRES_URL is used as default source for connection string, but further connection strings can be added as commandline arguments for both the waitfordb and createdb scripts.
WAIT_FOR_INSTANCE the waitfordb script uses only. If set to true, it checks if the instance is up and ignoring the set database name in the connection string(s).
DEBUG domain root for the log library (see https://github.com/collectai/node-logger )
Examples
it's recommended to set up in your project's package.json
. Example:
"scripts": {
"waitfordb": "POSTRGES_URL=postgres://dbuser@dbhostname.com:5432/databasename DEBUG=app* node $(npm bin)/waitfordb"
},
then it can be run as:
npm run waitfordb