Cotton code
36 lines · 1.2 KB · TypeScriptRaw
export interface Env {  ASSETS: Fetcher;  /**   * The darwin CI runner binary (`/mac/runner/…`, `src/shared/macRunner.ts`).   * The Mac app's zips are NOT here: see `MAC_FEED_ORIGIN`.   */  MAC_RELEASES: R2Bucket;  /**   * The serving Mac, through the relay — `https://<name>.relay.cottondb.com`,   * no trailing slash. `/mac/appcast.xml` and `/mac/download/<zip>` are   * forwarded there and answered by Cotton itself off the release records   * (`crates/cotton-server/src/routes/mac_feed.rs`). Unset, both answer 503 in   * plain text — never the site's HTML.   */  MAC_FEED_ORIGIN?: string;  /** Absolute origin the legacy hosts redirect to, no trailing slash. */  PUBLIC_ORIGIN?: string;}/** The production origin. See `PUBLIC_ORIGIN`. */export const DEFAULT_PUBLIC_ORIGIN = "https://cottondb.com";/** Everything the Worker knows about this deployment. */export interface SiteConfig {  publicOrigin: string;}/** Pure and env-shaped, so it unit-tests without a request. */export function readConfig(env: Partial<Env> | undefined): SiteConfig {  return {    publicOrigin: (env?.PUBLIC_ORIGIN || DEFAULT_PUBLIC_ORIGIN).replace(/\/+$/, ""),  };}