diff --git a/packages/app/src/index.ts b/packages/app/src/index.ts index 24741faa..b9ece0e5 100644 --- a/packages/app/src/index.ts +++ b/packages/app/src/index.ts @@ -162,24 +162,21 @@ app.get("/api/linear/options", async (c) => { }); app.get("/api/github/installations", async (c) => { const session = await owner(c); if (!session) return c.json({ error: "Unauthorized" }, 401); - if (c.env.GITHUB_INTEGRATION_ENABLED !== "true") return c.json({ error: "GitHub integration is not enabled" }, 404); return tenant(c, session.tenantId).fetch("https://tenant/github/installations"); }); app.get("/api/github/installations/:id/repositories", async (c) => { const session = await owner(c); if (!session) return c.json({ error: "Unauthorized" }, 401); - if (c.env.GITHUB_INTEGRATION_ENABLED !== "true") return c.json({ error: "GitHub integration is not enabled" }, 404); return tenant(c, session.tenantId).fetch(`https://tenant/github/installations/${encodeURIComponent(c.req.param("id"))}/repositories`); }); app.delete("/api/github/installations/:id", async (c) => { const session = await owner(c); if (!session) return c.json({ error: "Unauthorized" }, 401); - if (c.env.GITHUB_INTEGRATION_ENABLED !== "true") return c.json({ error: "GitHub integration is not enabled" }, 404); const response = await tenant(c, session.tenantId).fetch(`https://tenant/github/installations/${encodeURIComponent(c.req.param("id"))}`, { method: "DELETE" }); if (response.ok) await githubRegistry(c).fetch(`https://registry/installations/${encodeURIComponent(c.req.param("id"))}`, { method: "DELETE" }); return response; }); app.get("/auth/github/install", async (c) => { const session = await owner(c); if (!session) return c.redirect("/auth/linear"); - if (c.env.GITHUB_INTEGRATION_ENABLED !== "true" || !c.env.GITHUB_APP_SLUG) return c.text("GitHub integration is not enabled", 404); + if (!c.env.GITHUB_APP_SLUG) return c.text("GitHub App is not configured", 503); const nonce = crypto.randomUUID(); const state = await signSetupState({ tenantId: session.tenantId, userId: session.userId, nonce, exp: Math.floor(Date.now() / 1000) + 600 }, c.env.SESSION_SIGNING_SECRET); await tenant(c, session.tenantId).fetch("https://tenant/github/setup-state", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ nonce, exp: Math.floor(Date.now() / 1000) + 600 }) }); @@ -313,7 +310,6 @@ app.post("/webhooks/linear", async (c) => { }); app.post("/webhooks/github", async (c) => { - if (c.env.GITHUB_INTEGRATION_ENABLED !== "true") return c.text("Not found", 404); if (!c.env.GITHUB_WEBHOOK_SECRET) return c.text("Webhook verification is not configured", 503); const raw = await c.req.text(); const signature = c.req.header("X-Hub-Signature-256") ?? ""; diff --git a/packages/app/src/tenant.ts b/packages/app/src/tenant.ts index 2b5ad3d4..f2bed97a 100644 --- a/packages/app/src/tenant.ts +++ b/packages/app/src/tenant.ts @@ -1512,7 +1512,6 @@ export class Tenant extends DurableObject { if (valid.origin === "cloudflare" && (!source.tail?.signingSecret || source.tail.signingSecret.length < 32)) throw new Error("Cloudflare Tail signing is not configured."); return { kind: "custom", ...valid, handlerDeployment: source.handlerDeployment, ...(valid.origin === "cloudflare" ? { tail: source.tail } : {}) }; } - if (this.env.GITHUB_INTEGRATION_ENABLED !== "true") throw new Error("GitHub integration is not enabled"); if (source.baseRef !== "main" || source.trigger !== "merge_queue_conflict" || !Number.isSafeInteger(source.installationId) || !Number.isSafeInteger(source.repositoryId)) throw new Error("Invalid GitHub source"); const installation = this.one("SELECT state FROM github_installations WHERE installation_id=?", source.installationId) as Row | undefined; if (!installation || installation.state !== "active") throw new Error("GitHub installation is disconnected"); diff --git a/packages/app/src/types.ts b/packages/app/src/types.ts index f61b4543..4bd54d06 100644 --- a/packages/app/src/types.ts +++ b/packages/app/src/types.ts @@ -17,7 +17,6 @@ export interface Env { GITHUB_APP_SLUG?: string; GITHUB_APP_PRIVATE_KEY?: string; GITHUB_WEBHOOK_SECRET?: string; - GITHUB_INTEGRATION_ENABLED?: string; CUSTOM_SOURCES_ENABLED?: string; CUSTOM_HANDLER_LOADER?: WorkerLoader; RECOVERY_TIMEOUT_MS?: string; diff --git a/packages/app/wrangler.jsonc b/packages/app/wrangler.jsonc index b0ce32f6..2b307df0 100644 --- a/packages/app/wrangler.jsonc +++ b/packages/app/wrangler.jsonc @@ -14,7 +14,6 @@ "vars": { "APP_ORIGIN": "https://app.factorize.sh", "LINEAR_OAUTH_SCOPES": "read,write", - "GITHUB_INTEGRATION_ENABLED": "false", "CUSTOM_SOURCES_ENABLED": "true" } }