mailtrain/server/setup/sql/init.js
Tomas Bures e3a5a3c4eb Fixed some bugs in subscription process
Added timezone selector to campaign scheduling
Fixed problems with pausing campaign.
2019-07-10 02:06:56 +04:00

26 lines
695 B
JavaScript

'use strict';
let dbcheck = require('../../lib/dbcheck');
let log = require('npmlog');
let path = require('path');
let fs = require('fs');
log.level = 'verbose';
if (process.env.NODE_ENV === 'production') {
log.error('sqlinit', 'This script does not run in production');
process.exit(1);
}
if (process.env.NODE_ENV === 'test' && !fs.existsSync(path.join(__dirname, '..', '..', 'config', 'test.yaml'))) {
log.error('sqlinit', 'This script only runs in test if config/test.yaml (i.e. a dedicated test database) is present');
process.exit(1);
}
dbcheck(err => {
if (err) {
log.error('DB', err);
return process.exit(1);
}
return process.exit(0);
});