Using a single connection URL to configure MongoDB connection.

This commit is contained in:
Zaid Abdulla committed 2014-07-28 18:44:36 +03:00
1 parent f49c7b1ad9
commit 5d0f398bf7
3 files changed
+3 -14

No files matched your search

+1 -2
View File
@@ -1,6 +1,5 @@
{ {
"DATABASE_NAME" : "genieacs", "MONGODB_CONNECTION_URL" : "mongodb://localhost/genieacs",
"MONGODB_SOCKET" : "/tmp/mongodb-27017.sock",
"REDIS_SOCKET" : "6379", "REDIS_SOCKET" : "6379",
"ACS_INTERFACE" : "0.0.0.0", "ACS_INTERFACE" : "0.0.0.0",
"ACS_PORT" : 7547, "ACS_PORT" : 7547,
+1 -11
View File
@@ -15,7 +15,7 @@
# along with GenieACS. If not, see <http://www.gnu.org/licenses/>. # along with GenieACS. If not, see <http://www.gnu.org/licenses/>.
### ###
exports.DATABASE_NAME = 'genieacs' exports.MONGODB_CONNECTION_URL = 'mongodb://localhost/genieacs'
exports.REDIS_DB = 0 exports.REDIS_DB = 0
exports.ACS_PORT = 7547 # CWMP port as assigned by IANA exports.ACS_PORT = 7547 # CWMP port as assigned by IANA
exports.ACS_HTTPS_PORT = 7548 exports.ACS_HTTPS_PORT = 7548
@@ -42,16 +42,6 @@ exports.SESSION_TIMEOUT = 30
exports.GET_PARAMETER_NAMES_DEPTH_THRESHOLD = 0 exports.GET_PARAMETER_NAMES_DEPTH_THRESHOLD = 0
exports.TASK_PARAMETERS_BATCH_SIZE = 32 exports.TASK_PARAMETERS_BATCH_SIZE = 32
exports.MONGODB_OPTIONS = {
db : {
w : 1
wtimeout : 60000
}
server : {
auto_reconnect : true
}
}
# load configuration # load configuration
c = require('../config/config') c = require('../config/config')
for k, v of c for k, v of c
+1 -1
View File
@@ -29,7 +29,7 @@ objectsCollection = null
connect = (callback) -> connect = (callback) ->
callbackCounter = 6 callbackCounter = 6
mongodb.MongoClient.connect("mongodb://#{config.MONGODB_SOCKET}/#{config.DATABASE_NAME}", config.MONGODB_OPTIONS, (err, db) -> mongodb.MongoClient.connect(config.MONGODB_CONNECTION_URL, {db:{w:1},server:{autoReconnect:true}}, (err, db) ->
return callback(err) if err return callback(err) if err
exports.mongoDb = db exports.mongoDb = db
db.collection('tasks', (err, collection) -> db.collection('tasks', (err, collection) ->