Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[databases] use metadata for getting connection info

  • Loading branch information...
commit 4c865a48f656d5a684f77b8f05d00f8584449198 1 parent 85349bc
@cronopio cronopio authored
Showing with 8 additions and 12 deletions.
  1. +8 −12 lib/jitsu/commands/databases.js
View
20 lib/jitsu/commands/databases.js
@@ -299,11 +299,10 @@ var printDatabase = function (database) {
switch (database.type) {
case 'couch':
- var subdomain = database.metadata.id.split('/')[1];
printBase(database);
- var connUrl = 'http://' + subdomain + '.iriscouch.com:5984',
- sslConnUrl = 'https://' + subdomain + '.iriscouch.com:6984';
+ var connUrl = 'http://' + database.metadata.host + ':' + database.metadata.port,
+ sslConnUrl = 'https://' + database.metadata.host + ':' + database.metadata.port;
jitsu.log.data('Connection url: ' + connUrl.grey);
jitsu.log.data('SSL connection url: ' + sslConnUrl.grey);
@@ -311,7 +310,7 @@ var printDatabase = function (database) {
case 'mongo':
printBase(database);
- jitsu.log.data('Connection url: ' + (database.metadata.config.MONGOHQ_URL).grey);
+ jitsu.log.data('Connection url: ' + database.metadata.uri.grey + database.metadata.dbname.grey);
break;
case 'redis':
@@ -333,13 +332,10 @@ var printDatabase = function (database) {
};
var printDbHelp = function (database) {
-
switch (database.type) {
case 'couch':
- var subdomain = database.metadata.id.split('/')[1];
-
- var connUrl = 'http://' + subdomain + '.iriscouch.com:5984',
- sslConnUrl = 'https://' + subdomain + '.iriscouch.com:6984';
+ var connUrl = 'http://' + database.metadata.host + ':' + database.metadata.port,
+ sslConnUrl = 'https://' + database.metadata.host + ':' + database.metadata.port;
// TODO: Only write this if in some "verbose" mode.
[
@@ -361,8 +357,8 @@ var printDbHelp = function (database) {
break;
case 'mongo':
- var parsed = require('url').parse(database.metadata.config.MONGOHQ_URL),
- auth = parsed.auth.split(':');
+ var parsed = require('url').parse(database.metadata.uri + database.metadata.dbname),
+ auth = [database.metadata.username, database.metadata.password];
// TODO: Only write this if in some "verbose" mode.
[
@@ -387,7 +383,7 @@ var printDbHelp = function (database) {
'Connect with the `' + 'mongoose'.magenta + '` module:',
'',
' var mongoose = require(\'mongoose\');',
- ' mongoose.connect(\'' + database.metadata.config.MONGOHQ_URL + '\');',
+ ' mongoose.connect(\'' + database.metadata.uri + database.metadata.dbname + '\');',
''
].forEach(printHelp);
Please sign in to comment.
Something went wrong with that request. Please try again.