Skip to content

Commit dc370f6

Browse files
committed
adds port to possible connect arguments
1 parent eea9ecf commit dc370f6

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

bin/equinox

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ var yargs = require('yargs')
1212
.describe('user', 'User')
1313
.alias('p', 'password')
1414
.describe('password', 'Password')
15+
.alias('port', 'port')
16+
.describe('port', 'Port')
1517
.array('files')
1618
.describe('files', 'Files to load and execute')
1719
.describe('reporter', 'Test reporter')
@@ -50,7 +52,7 @@ if (argv.files) {
5052
}
5153

5254
// try to connect to the database
53-
db.connect (argv.database, argv.host, argv.user, argv.password, function (err) {
55+
db.connect (argv.database, argv.host, argv.user, argv.password, argv.port, function (err) {
5456
if (err) {
5557
console.log("ERROR: Unable to connect to database (" + err.toString() + ")");
5658
return;

lib/db.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ var pg = require('pg');
22

33
var pg_client;
44

5-
function connect (database, hostname, username, password, callback) {
5+
function connect (database, hostname, username, password, port, callback) {
66
var conString = 'postgres://';
77

88
if (username) {
@@ -16,6 +16,10 @@ function connect (database, hostname, username, password, callback) {
1616

1717
if (hostname) {
1818
conString += hostname;
19+
if (port) {
20+
conString += ':';
21+
conString += port;
22+
}
1923
conString += '/';
2024
}
2125

0 commit comments

Comments
 (0)