< Summary

Information
Class: debug-config.ts
Assembly: app.lib
File(s): /home/runner/work/ClutterStock/ClutterStock/frontend/app/lib/debug-config.ts
Tag: 58_25416222083
Line coverage
0%
Covered lines: 0
Uncovered lines: 20
Coverable lines: 20
Total lines: 54
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 10
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

File(s)

/home/runner/work/ClutterStock/ClutterStock/frontend/app/lib/debug-config.ts

#LineLine coverage
 1/** Keys safe to display (no secrets); values still appear in HTML—keep the route gated. */
 02const SERVER_DEBUG_ENV_KEYS = [
 3  "ENABLE_DEBUG_CONFIG",
 4  "NODE_ENV",
 5  "SERVER_API_URL",
 6  "API_URL",
 7  "VITE_API_URL",
 8  "PUBLIC_OTEL_EXPORTER_OTLP_TRACES_ENDPOINT",
 9  "PUBLIC_OTEL_SERVICE_NAME",
 10  "VITE_OTEL_EXPORTER_OTLP_TRACES_ENDPOINT",
 11  "VITE_OTEL_SERVICE_NAME",
 12  "OTEL_EXPORTER_OTLP_ENDPOINT",
 13  "OTEL_EXPORTER_OTLP_TRACES_ENDPOINT",
 14  "OTEL_EXPORTER_OTLP_METRICS_ENDPOINT",
 15  "OTEL_EXPORTER_OTLP_LOGS_ENDPOINT",
 16  "OTEL_EXPORTER_OTLP_PROTOCOL",
 17  "OTEL_SERVICE_NAME",
 18  "OTEL_SDK_DISABLED",
 19  "OTEL_RESOURCE_ATTRIBUTES",
 20] as const;
 21
 022export function isDebugConfigAllowed(): boolean {
 023  if (import.meta.env.DEV) return true;
 024  return process.env.ENABLE_DEBUG_CONFIG === "true";
 25}
 26
 027export function pickDebugServerEnv(): Record<string, string> {
 028  const out: Record<string, string> = {};
 029  for (const key of SERVER_DEBUG_ENV_KEYS) {
 030    out[key] = process.env[key] ?? "";
 31  }
 032  return out;
 33}
 34
 035function stringifyEnvValue(value: unknown): string {
 036  if (value === null || value === undefined) return "";
 037  if (
 38    typeof value === "string" ||
 39    typeof value === "number" ||
 40    typeof value === "boolean"
 41  ) {
 042    return String(value);
 43  }
 044  return JSON.stringify(value);
 45}
 46
 047export function pickImportMetaEnvForDebug(): Record<string, string> {
 048  const env = import.meta.env as Record<string, unknown>;
 049  const out: Record<string, string> = {};
 050  for (const key of Object.keys(env).sort((a, b) => a.localeCompare(b, "en"))) {
 051    out[key] = stringifyEnvValue(env[key]);
 52  }
 053  return out;
 54}