Permalink
Browse files

convert max database connections to a config variable for #57

  • Loading branch information...
1 parent 3d0adc8 commit c38db81578b42e308bf48a0903a24ab188425c6f @smurthas smurthas committed Apr 18, 2012
Showing with 5 additions and 31 deletions.
  1. +1 −29 Common/node/lconfig.js
  2. +2 −2 lib/dal.js
  3. +2 −0 test/auth/sample.test.js
@@ -49,6 +49,7 @@ exports.load = function(filepath) {
exports.airbrakeKey = config.airbrakeKey || undefined;
exports.stats = config.stats || {};
exports.database = config.database || {};
+ if(!exports.database.maxConnections) exports.database.maxConnections = 10;
exports.s3 = config.s3 || {};
exports.authSecrets = config.authSecrets || {crypt:'foo', sign:'bar'}; // these need to be required to be set in prod, trusted cookies use them during auth
exports.cookieExpire = config.cookieExpire || (60 * 60 * 24 * 30); // default 30 days
@@ -66,35 +67,6 @@ exports.load = function(filepath) {
setFromEnvs();
setBase();
exports.registryUpdateInterval = config.registryUpdateInterval || 3600;
- exports.collections = config.collections || [];
- /*
- [
- "contacts:Collections/Contacts",
- "links:Collections/Links",
- "photos:Collections/Photos",
- "places:Collections/Places",
- "search:Collections/Search"
- ];
- */
- exports.apps = config.apps || [];
- /*
- [
- "helloplaces:Apps/HelloPlaces",
- "linkalatte:Apps/LinkaLatte",
- "contactsviewer:Apps/MergedContacts",
- "devdocs:Apps/DevDocs",
- "photosviewer:Apps/PhotosViewer",
- "smtp:Connectors/SMTP",
- "facebook:Connectors/Facebook",
- "flickr:Connectors/Flickr",
- "github:Connectors/GitHub",
- "gcontacts:Connectors/GoogleContacts",
- "instagram:Connectors/Instagram",
- "twitter:Connectors/Twitter",
- "foursquare:Connectors/foursquare",
- "lastfm:Connectors/LastFM"
- ];
- */
// FIXME: me should get resolved into an absolute path, but much of the code base uses it relatively.
//
View
@@ -3,7 +3,7 @@ var lconfig = require("lconfig");
var path = require("path");
var async = require('async');
var logger = require("logger").logger("DAL");
-
+console.error("DEBUG: lconfig", lconfig);
var currentBackend = "mysql";
var pool = genericPool.Pool({
@@ -19,7 +19,7 @@ var pool = genericPool.Pool({
destroy:function(client) {
// TODO
},
- max: 100,
+ max: lconfig.database.maxConnections,
idleTimeoutMillis: 30000
});
module.exports = pool;
@@ -8,6 +8,8 @@ var mocha = require('mocha')
, helper = require(path.join(__dirname, '..', 'support', 'locker-helper.js'))
;
+helper.configurate();
+
var dal = require("dal");
dal.setBackend("fake");
var fakeDB = dal.getBackendModule();

0 comments on commit c38db81

Please sign in to comment.