mirror of
https://github.com/nodemailer/wildduck.git
synced 2025-01-02 21:52:34 +08:00
c9b9442de6
v1.0.11
21 lines
591 B
JavaScript
21 lines
591 B
JavaScript
'use strict';
|
|
|
|
const config = require('config');
|
|
const tools = require('./tools');
|
|
const mongodb = require('mongodb');
|
|
const redis = require('redis');
|
|
const MongoClient = mongodb.MongoClient;
|
|
|
|
module.exports.database = false;
|
|
module.exports.redis = false;
|
|
|
|
module.exports.connect = callback => {
|
|
MongoClient.connect(config.mongo, (err, database) => {
|
|
if (err) {
|
|
return callback(err);
|
|
}
|
|
module.exports.database = database;
|
|
module.exports.redis = redis.createClient(tools.redisConfig(config.redis));
|
|
callback(null, database);
|
|
});
|
|
};
|