aboutsummaryrefslogtreecommitdiffstats
path: root/packages/shared/config.ts
blob: e12c55c2a6d3771d54e8da25d032fad8ca6af890 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
const serverConfig = {
  apiUrl: process.env.API_URL ?? "http://localhost:3000",
  auth: {
    disableSignups: (process.env.DISABLE_SIGNUPS ?? "false") == "true",
  },
  openAI: {
    apiKey: process.env.OPENAI_API_KEY,
  },
  bullMQ: {
    redisHost: process.env.REDIS_HOST ?? "localhost",
    redisPort: parseInt(process.env.REDIS_PORT ?? "6379"),
  },
  crawler: {
    headlessBrowser: (process.env.CRAWLER_HEADLESS_BROWSER ?? "true") == "true",
    browserExecutablePath: process.env.BROWSER_EXECUTABLE_PATH, // If not set, the system's browser will be used
    browserUserDataDir: process.env.BROWSER_USER_DATA_DIR,
    browserWebUrl: process.env.BROWSER_WEB_URL,
  },
  meilisearch: process.env.MEILI_ADDR
    ? {
        address: process.env.MEILI_ADDR ?? "http://127.0.0.1:7700",
        key: process.env.MEILI_MASTER_KEY ?? "",
      }
    : undefined,
  logLevel: process.env.LOG_LEVEL ?? "debug",
  demoMode: (process.env.DEMO_MODE ?? "false") == "true",
  dataDir: process.env.DATA_DIR ?? "",
};

// Always explicitly pick up stuff from server config to avoid accidentally leaking stuff
export const clientConfig = {
  demoMode: serverConfig.demoMode,
  auth: {
    disableSignups: serverConfig.auth.disableSignups,
  }
};
export type ClientConfig = typeof clientConfig;

export default serverConfig;