From ede532df4c2c1475178659a61cd343b058b1267f Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Thu, 24 Nov 2022 00:06:02 +0200 Subject: [PATCH] mongodb auth db --- example.env | 1 + src/server/Server.js | 7 ++----- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/example.env b/example.env index 4531063..b974165 100644 --- a/example.env +++ b/example.env @@ -11,6 +11,7 @@ MONGO_PORT=27017 MONGO_USER= MONGO_PASS= MONGO_DB=framework-proto +MONGO_AUTH_DB=auth # Encryption secret CRYPTO_SECRET=verySecretSecret diff --git a/src/server/Server.js b/src/server/Server.js index ca5ba3a..8ec672a 100644 --- a/src/server/Server.js +++ b/src/server/Server.js @@ -34,7 +34,7 @@ class Server extends EventEmitter { const { MARIA_HOST, MARIA_USER, MARIA_PORT, MARIA_PASS, MARIA_DB, MONGO_HOST, MONGO_USER, MONGO_PORT, MONGO_PASS, MONGO_DB, - NODE_ENV, SECRET, CRYPTO_SECRET, CRYPTO_SALT } = process.env; + NODE_ENV, SECRET, CRYPTO_SECRET, CRYPTO_SALT, MONGO_AUTH_DB } = process.env; const { http: httpOpts, databases, validUserTypes } = options; // This key never leaves memory and is exclusively used on the server, the salt can stay static @@ -66,7 +66,7 @@ class Server extends EventEmitter { // Mariadb isn't strictly necessary here for anything, it's just here pre-emptively this.mariadb = new MariaDB(this, { options: databases.mariadb, MARIA_HOST, MARIA_USER, MARIA_PORT, MARIA_PASS, MARIA_DB }); // Mongo is used for session and user storage - 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, MONGO_AUTH_DB }); this.userDatabase = new UserDatabase(this, this.mongodb, { validUserTypes }); // Alias this.users = this.userDatabase; @@ -102,9 +102,6 @@ class Server extends EventEmitter { }, crossOriginResourcePolicy: { policy: 'cross-origin' - }, - crossOriginEmbedderPolicy: { - policy: 'require-corp' } })); this.app.use(express.json({ limit: '10mb' }));