cleaning up feed parameter logic
diff --git a/lib/utils.js b/lib/utils.js
index e10daf0..3e76be8 100644
--- a/lib/utils.js
+++ b/lib/utils.js
@@ -44,26 +44,28 @@
var sinceToUse = dataTrigger.since ? dataTrigger.since : "now";
var nanoConnection;
var dbURL;
-
- if (dataTrigger.accounturl.indexOf('cloudant.com') !== -1) {
- // contruct cloudant URL
- dbURL = 'https://' + dataTrigger.user + ':' + dataTrigger.pass + '@' + dataTrigger.user + '.cloudant.com';
+ var dbProtocol = 'https'; // unless specified protocol will default to https
+ if (dataTrigger.protocol) {
+ dbProtocol = dataTrigger.protocol;
+ }
+
+ // this needs to be updated since users might not have cloudant.com in there host name
+ if (dataTrigger.host.indexOf('cloudant.com') !== -1) {
+ // construct cloudant URL
+ dbURL = dbProtocol + '://' + dataTrigger.user + ':' + dataTrigger.pass + '@' + dataTrigger.host;
} else {
// construct couchDB URL
- dbURL = dataTrigger.accounturl;
- if (dataTrigger.protocol) {
- dbURL = dataTrigger.protocol + '://' + dataTrigger.host;
- }
+ dbURL = dbProtocol + '://' + dataTrigger.host;
}
-
+
// add port if specified
if (dataTrigger.port) {
dbURL = dbURL + ':' + dataTrigger.port
}
-
- logger.info(tid, 'found trigger accounturl: ', dbURL);
+
+ logger.info(tid, method,'found trigger accounturl: ', dbURL);
nanoConnection = require('nano')(dbURL);
-
+
return new Promise(function(resolve, reject) {
nanoConnection.auth(dataTrigger.user, dataTrigger.pass, function (err, body, headers) {