180 lines · 5.4 KB
import { env } from "cloudflare:workers";
import { validSitesDomain } from "./naming";
import type { ManifestFile } from "../pages/config";

export const SITE_LIMITS = {
  cpuMs: 50,
  subRequests: 50,
  deploysPerSitePerHour: 30,
  previewsPerPush: 5,
  envEntries: 64,
  envValueBytes: 4096,
  historyLimit: 50,
  sessionSeconds: 12 * 60 * 60,
} as const;

export const SCRATCH_LIMITS = {
  ttlMs: 24 * 60 * 60 * 1000,
  maxUploadBytes: 10 * 1024 * 1024,
  maxFiles: 500,
  maxTotalBytes: 25 * 1024 * 1024,
  perIpPerDay: 5,
  cpuMs: 10,
  subRequests: 0,
  reportsToDisable: 3,
} as const;

export type SiteAccess = "public" | "password" | "gitfor" | "oidc";
export type SiteEnvironment = "production" | "preview";

export type SiteRow = {
  id: string;
  owner_id: string | null;
  repo_id: string | null;
  label: string;
  source: "branch" | "workflow" | "upload";
  branch: string;
  folder: string;
  artifact_name: string;
  spa: number;
  previews: number;