1 parent 2cdf71f commit eea7aa9Copy full SHA for eea7aa9
1 file changed
src/server/config.ts
@@ -5,7 +5,7 @@
5
6
/* eslint-disable no-restricted-syntax */
7
8
-import { readFileSync } from "node:fs";
+import { existsSync, readFileSync } from "node:fs";
9
import { resolve } from "node:path";
10
11
import { DatabaseEngine, type IDatabaseConfig } from "./database.js";
@@ -27,7 +27,10 @@ export interface IServerConfig {
27
}
28
29
export const loadConfig = (): IServerConfig => {
30
- const raw = JSON.parse(readFileSync(configPath, "utf-8")) as Partial<IServerConfig>;
+ let raw: Partial<IServerConfig> = {};
31
+ if (existsSync(configPath)) {
32
+ raw = JSON.parse(readFileSync(configPath, "utf-8")) as Partial<IServerConfig>;
33
+ }
34
35
// Parse ALLOWED_ORIGINS env var (comma-separated).
36
const allowedOriginsEnv = process.env.ALLOWED_ORIGINS
0 commit comments