fix bad references to mongo

This commit is contained in:
Erik 2022-11-09 17:54:49 +02:00
parent d7323b23e9
commit afa2d9df39
Signed by: Navy.gif
GPG Key ID: 811EC0CD80E7E5FB
2 changed files with 3 additions and 3 deletions

View File

@ -53,7 +53,7 @@ class Server extends EventEmitter {
this.mongodb = new MongoDB(this, { options: databases.mongodb, MONGO_HOST, MONGO_USER, MONGO_PORT, MONGO_PASS, MONGO_DB }); this.mongodb = new MongoDB(this, { options: databases.mongodb, MONGO_HOST, MONGO_USER, MONGO_PORT, MONGO_PASS, MONGO_DB });
this.userDatabase = new UserDatabase(this, this.mongodb, { validUserTypes }); this.userDatabase = new UserDatabase(this, this.mongodb, { validUserTypes });
this.authenticator = new Authenticator(this, this.app, this.userDatabase, { this.authenticator = new Authenticator(this, this.app, this.userDatabase, {
mongo: this.mongodb.client, mongo: this.mongodb,
secret: SECRET, secret: SECRET,
discordID: DISCORD_ID, discordID: DISCORD_ID,
discordScope: discord.scope, discordScope: discord.scope,

View File

@ -35,7 +35,7 @@ class Authenticator {
if (!(users instanceof AbstractUserDatabase)) Util.fatal(new Error(`Expecting user database to be an instance inheriting AbstractUserDatabase`)); if (!(users instanceof AbstractUserDatabase)) Util.fatal(new Error(`Expecting user database to be an instance inheriting AbstractUserDatabase`));
this.userdb = users; this.userdb = users;
if (!mongo) Util.fatal(new Error('Missing mongo client for ')); if (!mongo) Util.fatal(new Error('Missing mongo client for session store'));
this.logger = server.createLogger(this); this.logger = server.createLogger(this);
@ -43,7 +43,7 @@ class Authenticator {
cookie.secure = cookie.secure && process.env.NODE_ENV !== 'development'; cookie.secure = cookie.secure && process.env.NODE_ENV !== 'development';
express.use(session({ express.use(session({
cookie, cookie,
store: MongoStore.create({ client: mongo, dbName: 'sessions' }), store: MongoStore.create({ client: mongo.client, dbName: mongo.database, touchAfter: 600 }),
secret, secret,
resave: false, resave: false,
saveUninitialized: true saveUninitialized: true