Implement MongoDB authentication
This commit is contained in:
parent
fa5221b128
commit
971fd7ca41
2 changed files with 8 additions and 3 deletions
|
@ -13,8 +13,8 @@ const CoinGecko = require('coingecko-api');
|
|||
//const RequestIP = require('@supercharge/request-ip');
|
||||
|
||||
var db = require('./config/db');
|
||||
mongoose.connect(db.url).then(() => {
|
||||
console.log("connecting-- ", db);
|
||||
mongoose.connect('mongodb://'+db.user+':'+db.password+'@'+db.server+'/'+db.database).then(() => {
|
||||
console.log("connecting-- ", db.database);
|
||||
}).catch(() => {
|
||||
console.log("connection failed!");
|
||||
});
|
||||
|
@ -128,6 +128,8 @@ var blockInterval = setInterval( function() {
|
|||
console.log(err);
|
||||
}
|
||||
console.log('Owner saved!');
|
||||
}).catch(() => {
|
||||
console.log('Owner exists');
|
||||
});
|
||||
}
|
||||
}).catch((err) => {
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
module.exports = {
|
||||
url : 'mongodb://localhost:27017/test'
|
||||
server : 'localhost:27017',
|
||||
user: 'zgo',
|
||||
password: 'zcashrules',
|
||||
database: 'zgo'
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue