Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
LINAGORA
L
LGS
Labs
voice-web
Commits
e953be80
Commit
e953be80
authored
Jun 06, 2017
by
Michael Henretty
Browse files
test postgres database creation in travis
parent
ec8217cb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
24 deletions
+13
-24
.travis.yml
.travis.yml
+4
-2
tools/createDb.js
tools/createDb.js
+6
-14
tools/dropDb.js
tools/dropDb.js
+3
-8
No files found.
.travis.yml
View file @
e953be80
...
...
@@ -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
tools/createDb.js
View file @
e953be80
...
...
@@ -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
;
...
...
tools/dropDb.js
View file @
e953be80
...
...
@@ -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
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment