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');
|
//const RequestIP = require('@supercharge/request-ip');
|
||||||
|
|
||||||
var db = require('./config/db');
|
var db = require('./config/db');
|
||||||
mongoose.connect(db.url).then(() => {
|
mongoose.connect('mongodb://'+db.user+':'+db.password+'@'+db.server+'/'+db.database).then(() => {
|
||||||
console.log("connecting-- ", db);
|
console.log("connecting-- ", db.database);
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
console.log("connection failed!");
|
console.log("connection failed!");
|
||||||
});
|
});
|
||||||
|
@ -128,6 +128,8 @@ var blockInterval = setInterval( function() {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
}
|
}
|
||||||
console.log('Owner saved!');
|
console.log('Owner saved!');
|
||||||
|
}).catch(() => {
|
||||||
|
console.log('Owner exists');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
url : 'mongodb://localhost:27017/test'
|
server : 'localhost:27017',
|
||||||
|
user: 'zgo',
|
||||||
|
password: 'zcashrules',
|
||||||
|
database: 'zgo'
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue