Use whole connection string in mongoose config

This commit is contained in:
Jonathan Barrow 2023-02-24 10:44:10 -05:00
parent 8e169ecb41
commit 2ad0375f1c
No known key found for this signature in database
GPG key ID: E86E9FE9049C741F

View file

@ -3,12 +3,12 @@ const PNIDSchema = require('./schema/pnid');
const config = require('../config.json');
const accountServerConfig = config.database.account;
const { uri, database, options } = accountServerConfig;
const { connection_string, options } = accountServerConfig;
let accountServerDBConnection;
let PNID;
async function connect() {
accountServerDBConnection = await mongoose.createConnection(`${uri}/${database}`, options);
accountServerDBConnection = await mongoose.createConnection(connection_string, options);
accountServerDBConnection.on('error', console.error.bind(console, 'Mongoose connection error:'));
accountServerDBConnection.on('close', () => {
accountServerDBConnection.removeAllListeners();