188 lines · 5.7 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,
  requestsPerDay: 10_000,
  cpuMsPerDay: 60_000,
  bytesOutPerDay: 1024 * 1024 * 1024,
  maxPushBytes: 10 * 1024 * 1024,
  maxPushRefs: 10,
} as const;

export const SCRATCH_ACCOUNT_ID = "sitesscratchaccount0";

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;