From 6138d6da5204486d0f6f1a4c916ced2a531b2948 Mon Sep 17 00:00:00 2001 From: Vladimir Filonov Date: Mon, 16 Dec 2024 21:12:13 +0400 Subject: [PATCH 1/2] Add FRIGADE_DISABLED env to control Frigade intagration --- docker/Dockerfile.dev.api | 1 + docs/deployment/configuration.mdx | 12 ++++++++++++ keep-ui/app/(keep)/settings/webhook-settings.tsx | 4 +++- keep-ui/app/frigade-provider.tsx | 8 ++++++++ keep-ui/components/navbar/UserInfo.tsx | 4 +++- keep-ui/shared/lib/server/getConfig.ts | 1 + keep-ui/types/internal-config.ts | 2 ++ tests/e2e_tests/docker-compose-e2e-mysql.yml | 2 ++ tests/e2e_tests/docker-compose-e2e-postgres.yml | 2 ++ tests/e2e_tests/docker-compose-e2e-redis.yml | 2 ++ 10 files changed, 36 insertions(+), 2 deletions(-) diff --git a/docker/Dockerfile.dev.api b/docker/Dockerfile.dev.api index d4f4e3a7b..def660dfa 100644 --- a/docker/Dockerfile.dev.api +++ b/docker/Dockerfile.dev.api @@ -22,6 +22,7 @@ ENV PYTHONPATH="/app:${PYTHONPATH}" ENV PATH="/venv/bin:${PATH}" ENV VIRTUAL_ENV="/venv" ENV POSTHOG_DISABLED="true" +ENV FRIGADE_DISABLED="true" ENTRYPOINT ["/app/keep/entrypoint.sh"] diff --git a/docs/deployment/configuration.mdx b/docs/deployment/configuration.mdx index ddf404912..61a7a501d 100644 --- a/docs/deployment/configuration.mdx +++ b/docs/deployment/configuration.mdx @@ -157,6 +157,18 @@ Sentry configuration controls Keep's integration with Sentry for error monitorin |:-------------------:|:-------:|:----------:|:-------------:|:-------------:| | **SENTRY_DISABLED** | Disables Sentry integration | No | "false" | "true" or "false" | + +### Frigade + + +Frigade configuration controls Keep's integration with the Frigade onboarding platform. + + +| Env var | Purpose | Required | Default Value | Valid options | +|:-------------------:|:-------:|:----------:|:-------------:|:-------------:| +| **FRIGADE_DISABLED** | Disables Frigade integration | No | "false" | "true" or "false" | + + ### Ngrok Ngrok configuration enables secure tunneling to your Keep instance. These settings are particularly useful for development or when you need to expose your local Keep instance to the internet securely. diff --git a/keep-ui/app/(keep)/settings/webhook-settings.tsx b/keep-ui/app/(keep)/settings/webhook-settings.tsx index 6e28c76b7..12add8029 100644 --- a/keep-ui/app/(keep)/settings/webhook-settings.tsx +++ b/keep-ui/app/(keep)/settings/webhook-settings.tsx @@ -23,6 +23,7 @@ import { v4 as uuidv4 } from "uuid"; import { ExclamationCircleIcon } from "@heroicons/react/24/outline"; import * as Frigade from "@frigade/react"; import { useApi } from "@/shared/lib/hooks/useApi"; +import {useConfig} from "@/utils/hooks/useConfig"; interface Webhook { webhookApi: string; @@ -38,6 +39,7 @@ export default function WebhookSettings({ selectedTab }: Props) { const [codeTabIndex, setCodeTabIndex] = useState(0); const api = useApi(); + const { data: config } = useConfig(); const { data, error, isLoading } = useSWR( api.isReady() && selectedTab === "webhook" ? `/settings/webhook` : null, @@ -188,7 +190,7 @@ req.end(); > Click to create an example Alert - + {config?.FRIGADE_DISABLED ? null : } { const { data: session } = useSession(); + const { data: config } = useConfig(); + + if (!config || config.FRIGADE_DISABLED === "true") { + return <> + {children} + ; + } return ( { + const { data: config } = useConfig(); + const { flow } = Frigade.useFlow(ONBOARDING_FLOW_ID); const [isOnboardingOpen, setIsOnboardingOpen] = useState(false); return ( <>
    - {flow?.isCompleted === false && ( + {!config?.FRIGADE_DISABLED && flow?.isCompleted === false && (
  • Date: Mon, 23 Dec 2024 19:11:50 +0400 Subject: [PATCH 2/2] Prettier --- keep-ui/app/(keep)/settings/webhook-settings.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/keep-ui/app/(keep)/settings/webhook-settings.tsx b/keep-ui/app/(keep)/settings/webhook-settings.tsx index 12add8029..379721ac4 100644 --- a/keep-ui/app/(keep)/settings/webhook-settings.tsx +++ b/keep-ui/app/(keep)/settings/webhook-settings.tsx @@ -23,7 +23,7 @@ import { v4 as uuidv4 } from "uuid"; import { ExclamationCircleIcon } from "@heroicons/react/24/outline"; import * as Frigade from "@frigade/react"; import { useApi } from "@/shared/lib/hooks/useApi"; -import {useConfig} from "@/utils/hooks/useConfig"; +import { useConfig } from "@/utils/hooks/useConfig"; interface Webhook { webhookApi: string; @@ -190,7 +190,9 @@ req.end(); > Click to create an example Alert - {config?.FRIGADE_DISABLED ? null : } + {config?.FRIGADE_DISABLED ? null : ( + + )}