MCPcopy
hub / github.com/learnhouse/learnhouse / getConfig

Function getConfig

apps/web/services/config/config.ts:59–69  ·  view source on GitHub ↗
(key: string, defaultValue: string = '')

Source from the content-addressed store, hash-verified

57
58// Helper function to get config value with fallback
59export const getConfig = (key: string, defaultValue: string = ''): string => {
60 const config = loadRuntimeConfig();
61
62 // 1. Check runtime config (from runtime-config.json or the generated runtime-config.js)
63 if (config && config[key]) {
64 return config[key];
65 }
66
67 // 2. Fallback to process.env (Server-side only)
68 return process.env[key] || defaultValue;
69};
70
71// Helper to read a cookie value by name (client-side only)
72const getCookieValue = (name: string): string | null => {

Callers 15

getMediaUrlFunction · 0.90
getDomainFromRequestFunction · 0.90
route.tsFile · 0.90
route.tsFile · 0.90
getLEARNHOUSE_DOMAINFunction · 0.85
getLEARNHOUSE_TOP_DOMAINFunction · 0.85
deriveAPIUrlFunction · 0.85
getUriWithOrgFunction · 0.85

Calls 1

loadRuntimeConfigFunction · 0.85

Tested by

no test coverage detected