Commit
β’
8bb1351
1
Parent(s):
17d2394
π§βπ» Explicit error message when MongoDB configuration lacking (#208)
Browse files
src/lib/server/database.ts
CHANGED
@@ -6,6 +6,12 @@ import type { AbortedGeneration } from "$lib/types/AbortedGeneration";
|
|
6 |
import type { Settings } from "$lib/types/Settings";
|
7 |
import type { User } from "$lib/types/User";
|
8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
const client = new MongoClient(MONGODB_URL, {
|
10 |
// directConnection: true
|
11 |
});
|
|
|
6 |
import type { Settings } from "$lib/types/Settings";
|
7 |
import type { User } from "$lib/types/User";
|
8 |
|
9 |
+
if (!MONGODB_URL) {
|
10 |
+
throw new Error(
|
11 |
+
"Please specify the MONGODB_URL environment variable inside .env.local. Set it to mongodb://localhost:27017 if you are running MongoDB locally, or to a MongoDB Atlas free instance for example."
|
12 |
+
);
|
13 |
+
}
|
14 |
+
|
15 |
const client = new MongoClient(MONGODB_URL, {
|
16 |
// directConnection: true
|
17 |
});
|