(
opts: { noStore?: boolean } = {},
)
| 67 | * wrapper below makes this explicit at the call site. |
| 68 | */ |
| 69 | export function getRuntimeConfig( |
| 70 | opts: { noStore?: boolean } = {}, |
| 71 | ): RuntimeConfig { |
| 72 | if (opts.noStore !== false) noStore(); |
| 73 | const isProd = process.env.NODE_ENV === "production"; |
| 74 | |
| 75 | const baseUrl = readUrl( |
| 76 | "NEXT_PUBLIC_BASE_URL", |
| 77 | // baseUrl preserves the prior `https://docs.copilotkit.ai` prod |
| 78 | // fallback (matches the legacy getBaseUrl() behavior in |
| 79 | // sitemap-helpers.ts) so a misconfigured deploy still emits a |
| 80 | // reasonable sitemap rather than a sentinel URL. Logged either way. |
| 81 | isProd ? PROD_BASE_URL_FALLBACK : "http://localhost:3003", |
| 82 | isProd, |
| 83 | "fatal", |
| 84 | ); |
| 85 | const shellUrl = readUrl( |
| 86 | "NEXT_PUBLIC_SHELL_URL", |
| 87 | isProd ? PROD_INVALID_SHELL_URL : "http://localhost:3000", |
| 88 | isProd, |
| 89 | "fatal", |
| 90 | ); |
| 91 | // intelligenceSignupUrl: prod fallback IS a real working host |
| 92 | // (dashboard.operations.copilotkit.ai), not a sentinel — so absence is |
| 93 | // recoverable. Demote from FATAL-CONFIG to a non-fatal warn (no |
| 94 | // `FATAL-CONFIG:` prefix → no Sentry alert) so absence does not |
| 95 | // generate false-positive alerts, but the line still clears prod |
| 96 | // log-aggregation thresholds and stays operator-visible. Same logic |
| 97 | // for posthogHost (EU cloud is the default). |
| 98 | const intelligenceSignupUrl = readUrl( |
| 99 | "NEXT_PUBLIC_INTELLIGENCE_SIGNUP_URL", |
| 100 | PROD_DEFAULT_SIGNUP_URL, |
| 101 | isProd, |
| 102 | "info", |
| 103 | ); |
| 104 | const posthogHost = readUrl( |
| 105 | "NEXT_PUBLIC_POSTHOG_HOST", |
| 106 | PROD_DEFAULT_POSTHOG_HOST, |
| 107 | isProd, |
| 108 | "info", |
| 109 | ); |
| 110 | |
| 111 | return { |
| 112 | baseUrl, |
| 113 | shellUrl, |
| 114 | intelligenceSignupUrl, |
| 115 | posthogKey: readKey("NEXT_PUBLIC_POSTHOG_KEY"), |
| 116 | posthogHost, |
| 117 | scarfPixelId: readKey("NEXT_PUBLIC_SCARF_PIXEL_ID"), |
| 118 | googleAnalyticsTrackingId: readKey( |
| 119 | "NEXT_PUBLIC_GOOGLE_ANALYTICS_TRACKING_ID", |
| 120 | ), |
| 121 | reb2bKey: readKey("NEXT_PUBLIC_REB2B_KEY"), |
| 122 | reoKey: readKey("NEXT_PUBLIC_REO_KEY"), |
| 123 | }; |
| 124 | } |
| 125 | |
| 126 | /** |
no test coverage detected
searching dependent graphs…