mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-20 10:20:15 +01:00
define mongodb name
This commit is contained in:
parent
2f462c9b3c
commit
12ac302a68
1 changed files with 5 additions and 0 deletions
|
|
@ -1,10 +1,14 @@
|
|||
require('dotenv').config();
|
||||
const mongoose = require('mongoose');
|
||||
const MONGO_URI = process.env.MONGO_URI;
|
||||
const MONGO_DB_NAME = process.env.MONGO_DB_NAME;
|
||||
|
||||
if (!MONGO_URI) {
|
||||
throw new Error('Please define the MONGO_URI environment variable');
|
||||
}
|
||||
if (!MONGO_DB_NAME) {
|
||||
MONGO_DB_NAME = null
|
||||
}
|
||||
|
||||
/**
|
||||
* Global is used here to maintain a cached connection across hot reloads
|
||||
|
|
@ -26,6 +30,7 @@ async function connectDb() {
|
|||
if (!cached.promise || disconnected) {
|
||||
const opts = {
|
||||
bufferCommands: false,
|
||||
dbName: MONGO_DB_NAME,
|
||||
// useNewUrlParser: true,
|
||||
// useUnifiedTopology: true,
|
||||
// bufferMaxEntries: 0,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue