mirror of
https://github.com/PretendoNetwork/website.git
synced 2026-03-21 17:24:28 -05:00
Use a full Mongo URI instead of address and port in config
This commit is contained in:
parent
3183e45fb2
commit
ad60c70831
|
|
@ -23,8 +23,7 @@
|
|||
},
|
||||
"database": {
|
||||
"account": {
|
||||
"address": "127.0.0.1",
|
||||
"port": 27017,
|
||||
"uri": "mongodb://127.0.0.1:27017",
|
||||
"database_name": "pretendo",
|
||||
"options": {
|
||||
"useNewUrlParser": true,
|
||||
|
|
|
|||
|
|
@ -3,12 +3,11 @@ const PNIDSchema = require('./schema/pnid');
|
|||
const config = require('../config.json');
|
||||
|
||||
const accountServerConfig = config.database.account;
|
||||
const accountServerURI = `mongodb://${accountServerConfig.address}:${accountServerConfig.port}/${accountServerConfig.database_name}`;
|
||||
let accountServerDBConnection;
|
||||
let PNID;
|
||||
|
||||
async function connect() {
|
||||
accountServerDBConnection = await mongoose.createConnection(accountServerURI, accountServerConfig.options);
|
||||
accountServerDBConnection = await mongoose.createConnection(accountServerConfig.uri, accountServerConfig.options);
|
||||
accountServerDBConnection.on('error', console.error.bind(console, 'Mongoose connection error:'));
|
||||
accountServerDBConnection.on('close', () => {
|
||||
accountServerDBConnection.removeAllListeners();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user