diff --git a/apps/webapp/app/env.server.ts b/apps/webapp/app/env.server.ts index 612823278..7f5acba19 100644 --- a/apps/webapp/app/env.server.ts +++ b/apps/webapp/app/env.server.ts @@ -156,6 +156,10 @@ const EnvironmentSchema = z.object({ ORG_SLACK_INTEGRATION_CLIENT_ID: z.string().optional(), ORG_SLACK_INTEGRATION_CLIENT_SECRET: z.string().optional(), + + /** These enable the alerts feature in v3 */ + ALERT_FROM_EMAIL: z.string().optional(), + ALERT_RESEND_API_KEY: z.string().optional(), }); export type Environment = z.infer; diff --git a/apps/webapp/app/features.server.ts b/apps/webapp/app/features.server.ts index 505fa470f..a5f11e79b 100644 --- a/apps/webapp/app/features.server.ts +++ b/apps/webapp/app/features.server.ts @@ -4,6 +4,7 @@ import { requestUrl } from "./utils/requestUrl.server"; export type TriggerFeatures = { isManagedCloud: boolean; v3Enabled: boolean; + alertsEnabled: boolean; }; // If the request host is cloud.trigger.dev then we are on the managed cloud @@ -20,5 +21,6 @@ export function featuresForRequest(request: Request): TriggerFeatures { return { isManagedCloud, v3Enabled: env.V3_ENABLED === "true", + alertsEnabled: env.ALERT_FROM_EMAIL !== undefined && env.ALERT_RESEND_API_KEY !== undefined, }; } diff --git a/apps/webapp/app/hooks/useFeatures.ts b/apps/webapp/app/hooks/useFeatures.ts index 6a726d74b..9882f432d 100644 --- a/apps/webapp/app/hooks/useFeatures.ts +++ b/apps/webapp/app/hooks/useFeatures.ts @@ -5,5 +5,5 @@ import type { TriggerFeatures } from "~/features.server"; export function useFeatures(): TriggerFeatures { const routeMatch = useTypedRouteLoaderData("root"); - return routeMatch?.features ?? { isManagedCloud: false, v3Enabled: false }; + return routeMatch?.features ?? { isManagedCloud: false, v3Enabled: false, alertsEnabled: false }; }