← Files DataARCHIVED FILE

output_formats/html/src/sites-runtime-setting.js

561 Bytes · Nov 19, 2026 · 00:12 UTC

↓ Download file

See the change to this file →

// Regional Sites use asynchronous secret bindings; other Sites use strings.
// A present regional binding is authoritative, even when unavailable. Never
// fall back to a stale direct value or cache a setting across requests.
export async function readSitesRuntimeSetting(environment, key) {
  try {
    const bindingKey = `SECRET_${key}`;
    const value = environment && bindingKey in environment
      ? await environment[bindingKey]?.get()
      : environment?.[key];
    return typeof value === "string" ? value : null;
  } catch {
    return null;
  }
}

SHA-256: d8761c104a76e8c32cc0508cf04c37a64434e8fedf397a0e9e9b043b15d01dae