| 1 | import type { DiffineryEvent } from "@diffinery/shared"; |
| 2 | import type { RepoDO } from "./repo/RepoDO.js"; |
| 3 | import type { ImportContainer } from "./imports/container.js"; |
| 4 | import type { RunnerContainer, SandboxContainer } from "./runner/containers.js"; |
| 5 | import type { MailJob } from "./mail/types.js"; |
| 6 | |
| 7 | export interface Env { |
| 8 | DB: D1Database; |
| 9 | BUCKET: R2Bucket; |
| 10 | EVENTS: Queue<DiffineryEvent>; |
| 11 | REPO: DurableObjectNamespace<RepoDO>; |
| 12 | RUNNER: DurableObjectNamespace<RunnerContainer>; |
| 13 | SANDBOX: DurableObjectNamespace<SandboxContainer>; |
| 14 | RUN_WORKFLOW: Workflow<{ repoId: string; runId: string }>; |
| 15 | /** Cloudflare Email Sending. Missing when sending isn't set up; emails are then logged as skipped. */ |
| 16 | EMAIL?: SendEmail; |
| 17 | /** Email jobs, sent by the queue consumer in mail/send.ts. */ |
| 18 | MAIL?: Queue<MailJob>; |
| 19 | IMPORT_WORKFLOW: Workflow<{ importId: string }>; |
| 20 | /** GitHub imports copy Git data in this container (absent under `wrangler dev`). */ |
| 21 | IMPORTER?: DurableObjectNamespace<ImportContainer>; |
| 22 | /** "external": an import agent started outside the Worker claims the Git transfer (local development and tests). */ |
| 23 | IMPORT_GIT_AGENT?: string; |
| 24 | /** Largest source repository an import will take, in KB (GitHub `size`); default 10 GB. */ |
| 25 | IMPORT_MAX_REPO_KB?: string; |
| 26 | /** Optional GitHub OAuth app, for linking an account through the web flow instead of a gist. */ |
| 27 | GITHUB_OAUTH_CLIENT_ID?: string; |
| 28 | GITHUB_OAUTH_CLIENT_SECRET?: string; |
| 29 | |
| 30 | /** Canonical origin, e.g. https://diffinery.com */ |
| 31 | PUBLIC_URL: string; |
| 32 | /** Sender address for every email, e.g. notifications@diffinery.com. */ |
| 33 | MAIL_FROM?: string; |
| 34 | /** Comma-separated emails or logins that become site admins on first sign-in. */ |
| 35 | BOOTSTRAP_ADMINS: string; |
| 36 | /** e.g. codician.cloudflareaccess.com — empty disables Access verification. */ |
| 37 | ACCESS_TEAM_DOMAIN: string; |
| 38 | /** Access application audience tag. */ |
| 39 | ACCESS_AUD: string; |
| 40 | /** Artifact storage per repository in bytes (live artifacts plus uploads in progress); default 10 GiB. */ |
| 41 | ARTIFACT_QUOTA_BYTES?: string; |
| 42 | /** Local development only: act as this email when Access is not configured. */ |
| 43 | DEV_AUTH?: string; |
| 44 | |
| 45 | /** Secret: base64 32 bytes; root key for envelope encryption of secrets. */ |
| 46 | MASTER_KEY?: string; |
| 47 | /** Secret: ES256 private JWK (JSON) used to sign OIDC tokens for jobs. */ |
| 48 | OIDC_PRIVATE_KEY?: string; |
| 49 | /** Optional GitHub Enterprise host (e.g. github.example.com) the importer may download release assets from. */ |
| 50 | IMPORT_GHE_HOST?: string; |
| 51 | } |