mongodb auth db

This commit is contained in:
Erik 2022-11-24 00:06:02 +02:00
parent b5820dafde
commit ede532df4c
Signed by: Navy.gif
GPG Key ID: 811EC0CD80E7E5FB
2 changed files with 3 additions and 5 deletions

View File

@ -11,6 +11,7 @@ MONGO_PORT=27017
MONGO_USER= MONGO_USER=
MONGO_PASS= MONGO_PASS=
MONGO_DB=framework-proto MONGO_DB=framework-proto
MONGO_AUTH_DB=auth
# Encryption secret # Encryption secret
CRYPTO_SECRET=verySecretSecret CRYPTO_SECRET=verySecretSecret

View File

@ -34,7 +34,7 @@ class Server extends EventEmitter {
const { MARIA_HOST, MARIA_USER, MARIA_PORT, MARIA_PASS, MARIA_DB, const { MARIA_HOST, MARIA_USER, MARIA_PORT, MARIA_PASS, MARIA_DB,
MONGO_HOST, MONGO_USER, MONGO_PORT, MONGO_PASS, MONGO_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; const { http: httpOpts, databases, validUserTypes } = options;
// This key never leaves memory and is exclusively used on the server, the salt can stay static // 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 // 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 }); 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 // 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 }); this.userDatabase = new UserDatabase(this, this.mongodb, { validUserTypes });
// Alias // Alias
this.users = this.userDatabase; this.users = this.userDatabase;
@ -102,9 +102,6 @@ class Server extends EventEmitter {
}, },
crossOriginResourcePolicy: { crossOriginResourcePolicy: {
policy: 'cross-origin' policy: 'cross-origin'
},
crossOriginEmbedderPolicy: {
policy: 'require-corp'
} }
})); }));
this.app.use(express.json({ limit: '10mb' })); this.app.use(express.json({ limit: '10mb' }));