Spaces:
Build error
Build error
Commit
•
1b9697f
1
Parent(s):
ff2db2e
🔧 Add "directConnection" option to MongoDB (#260)
Browse files- .env +2 -0
- src/lib/server/database.ts +2 -2
.env
CHANGED
@@ -3,6 +3,8 @@
|
|
3 |
|
4 |
MONGODB_URL=#your mongodb URL here
|
5 |
MONGODB_DB_NAME=chat-ui
|
|
|
|
|
6 |
COOKIE_NAME=hf-chat
|
7 |
HF_ACCESS_TOKEN=#hf_<token> from from https://huggingface.co/settings/token
|
8 |
|
|
|
3 |
|
4 |
MONGODB_URL=#your mongodb URL here
|
5 |
MONGODB_DB_NAME=chat-ui
|
6 |
+
MONGODB_DIRECT_CONNECTION=false
|
7 |
+
|
8 |
COOKIE_NAME=hf-chat
|
9 |
HF_ACCESS_TOKEN=#hf_<token> from from https://huggingface.co/settings/token
|
10 |
|
src/lib/server/database.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
import { MONGODB_URL, MONGODB_DB_NAME } from "$env/static/private";
|
2 |
import { MongoClient } from "mongodb";
|
3 |
import type { Conversation } from "$lib/types/Conversation";
|
4 |
import type { SharedConversation } from "$lib/types/SharedConversation";
|
@@ -13,7 +13,7 @@ if (!MONGODB_URL) {
|
|
13 |
}
|
14 |
|
15 |
const client = new MongoClient(MONGODB_URL, {
|
16 |
-
|
17 |
});
|
18 |
|
19 |
export const connectPromise = client.connect().catch(console.error);
|
|
|
1 |
+
import { MONGODB_URL, MONGODB_DB_NAME, MONGODB_DIRECT_CONNECTION } from "$env/static/private";
|
2 |
import { MongoClient } from "mongodb";
|
3 |
import type { Conversation } from "$lib/types/Conversation";
|
4 |
import type { SharedConversation } from "$lib/types/SharedConversation";
|
|
|
13 |
}
|
14 |
|
15 |
const client = new MongoClient(MONGODB_URL, {
|
16 |
+
directConnection: MONGODB_DIRECT_CONNECTION === "true",
|
17 |
});
|
18 |
|
19 |
export const connectPromise = client.connect().catch(console.error);
|