Commits

Alvaro Videla committed 5d60b40

builds plain mongodb url

Comments (0)

Files changed (1)

lib/cloudFoundryUtil.js

 }
 
 function getMongoCredentials(dbServiceName) {
-    //default
-    var credentials = {
+    return {
         "hostname": "localhost",
         "port": 27017,
-        "username": "",
-        "password": "",
+        "username": "cloudstagram",
+        "password": "cloudstagrampass",
         "name": "",
         "db": "cloudstagram"
-    }
-
-    if (cloudfoundry.cloud && cloudfoundry.mongodb) {
-        var service;
-        
-        if(dbServiceName) {
-            service = cloudfoundry.mongodb[dbServiceName];
-        } else {
-            //select first one
-            for( var name in cloudfoundry.mongodb) {
-                service = cloudfoundry.mongodb[name];
-                break;
-            };
-        }
-        
-        if(service) {
-            credentials = service.credentials;
-        }
-    }
-
-    return credentials;
+    };
 }
 
 function getMongoUrl(dbServiceName) {
-    var mongoUrl;
     var credentials = getMongoCredentials();
-
-    if (credentials.username && credentials.password) {
-        mongoUrl = "mongodb://" + credentials.username + ":" 
-            + credentials.password + "@" + credentials.hostname 
-            + ":" + credentials.port + "/" + credentials.db;
-    } else {
-        mongoUrl = "mongodb://" + credentials.hostname + ":" + credentials.port + "/" + credentials.db;
-    }
+    var mongoUrl = "mongodb://" + credentials.username + ":" 
+        + credentials.password + "@" + credentials.hostname 
+        + ":" + credentials.port + "/" + credentials.db;
 
     console.log("MongoUrl: " + mongoUrl);
     return mongoUrl;