MCPcopy Index your code
hub / github.com/CopilotKit/CopilotKit / readUrl

Function readUrl

showcase/shell-docs/src/lib/runtime-config.ts:165–198  ·  view source on GitHub ↗
(
  envKey: string,
  fallback: string,
  isProd: boolean,
  severity: "fatal" | "info" = "fatal",
)

Source from the content-addressed store, hash-verified

163}
164
165function readUrl(
166 envKey: string,
167 fallback: string,
168 isProd: boolean,
169 severity: "fatal" | "info" = "fatal",
170): string {
171 const value = readEnvPair(envKey);
172 if (value !== undefined) return value.replace(/\/+$/, "");
173 if (isProd) {
174 if (severity === "fatal") {
175 // eslint-disable-next-line no-console
176 console.error(
177 `[shell-docs runtime-config] FATAL-CONFIG: ${envKey} is unset in a production deploy; ` +
178 `using fallback ${fallback}. Set the env var on the Railway service.`,
179 );
180 } else {
181 // warn-level: legitimate prod default exists; absence is
182 // recoverable so we log but do not raise the FATAL-CONFIG flag
183 // that triggers ops alerts. console.warn (not console.info) so
184 // the line clears prod log-aggregation thresholds and stays
185 // visible to operators.
186 // eslint-disable-next-line no-console
187 console.warn(
188 `[shell-docs runtime-config] ${envKey} unset; using prod default ${fallback}`,
189 );
190 }
191 } else {
192 // eslint-disable-next-line no-console
193 console.warn(
194 `[shell-docs runtime-config] ${envKey} unset; using dev fallback ${fallback}`,
195 );
196 }
197 return fallback.replace(/\/+$/, "");
198}
199
200/**
201 * Read an analytics key. Empty/missing values are returned as the empty

Callers 1

getRuntimeConfigFunction · 0.70

Calls 3

readEnvPairFunction · 0.70
errorMethod · 0.65
warnMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…