Implement MongoDB authentication

This commit is contained in:
Rene Vergara 2021-11-04 13:10:56 -05:00
parent fa5221b128
commit 971fd7ca41
2 changed files with 8 additions and 3 deletions

View file

@ -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) => {

View file

@ -1,3 +1,6 @@
module.exports = {
url : 'mongodb://localhost:27017/test'
server : 'localhost:27017',
user: 'zgo',
password: 'zcashrules',
database: 'zgo'
}