Commit e953be80 authored by Michael Henretty's avatar Michael Henretty
Browse files

test postgres database creation in travis

parent ec8217cb
......@@ -4,7 +4,9 @@ node_js:
- "7"
services:
- postgresql
addons:
postgresql: "9.5"
before_script:
- npm install -g gulp
- npm install -g gulp-cli
script:
- gulp build
- gulp create && gulp ts
......@@ -13,20 +13,15 @@ const DBNAME = config.PGNAME || DEFAULT;
*/
function run(callback) {
// Make sure we have a superuser username and password
let user = config.DB_ROOT_USER;
let pass = config.DB_ROOT_PASS;
let user = config.DB_ROOT_USER || 'postgres';
let pass = config.DB_ROOT_PASS || '';
if (!user) {
console.error('need DB_ROOT_USER defined in config.json');
process.exitCode = 1;
return;
}
if (!pass) {
console.error('need DB_ROOT_PASS defined in config.json');
process.exitCode = 1;
return;
}
// Log in as superuser to create user and tables for voice-web.
let pg = new Postgres({
user: user,
......@@ -74,6 +69,7 @@ function run(callback) {
.onComplete((err, result) => {
if (err) {
console.error('database create error', err);
process.exitCode = 1;
}
// Clean up any open connections.
......@@ -87,13 +83,9 @@ function run(callback) {
// Allow running as a script and module.
if (require.main === module) {
run(err => {
if (err) {
console.error('Problem creating db', err);
process.exitCode = 1;
return;
if (!err) {
console.log('Db created.');
}
console.log('Db created.');
});
} else {
exports.run = run;
......
......@@ -10,20 +10,15 @@ const USERNAME = 'voiceweb' || config.PGUSER;
*/
function run(callback) {
// Make sure we have a superuser username and password
let user = config.DB_ROOT_USER;
let pass = config.DB_ROOT_PASS;
let user = config.DB_ROOT_USER || 'postgres';
let pass = config.DB_ROOT_PASS || '';
if (!user) {
console.error('need DB_ROOT_USER defined in config.json');
process.exitCode = 1;
return;
}
if (!pass) {
console.error('need DB_ROOT_PASS defined in config.json');
process.exitCode = 1;
return;
}
let pg = new Postgres({
user: user,
password: pass,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment