Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add FRIGADE_DISABLED env to control Frigade intagration #2846

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docker/Dockerfile.dev.api
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand Down
12 changes: 12 additions & 0 deletions docs/deployment/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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

<Info>
Frigade configuration controls Keep's integration with the Frigade onboarding platform.
</Info>

| Env var | Purpose | Required | Default Value | Valid options |
|:-------------------:|:-------:|:----------:|:-------------:|:-------------:|
| **FRIGADE_DISABLED** | Disables Frigade integration | No | "false" | "true" or "false" |


### Ngrok
<Info>
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.
Expand Down
4 changes: 3 additions & 1 deletion keep-ui/app/(keep)/settings/webhook-settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -38,6 +39,7 @@ export default function WebhookSettings({ selectedTab }: Props) {
const [codeTabIndex, setCodeTabIndex] = useState<number>(0);

const api = useApi();
const { data: config } = useConfig();

const { data, error, isLoading } = useSWR<Webhook>(
api.isReady() && selectedTab === "webhook" ? `/settings/webhook` : null,
Expand Down Expand Up @@ -188,7 +190,7 @@ req.end();
>
Click to create an example Alert
</Button>
<Frigade.Tour flowId="flow_4iLdns11" />
{config?.FRIGADE_DISABLED ? null : <Frigade.Tour flowId="flow_4iLdns11" />}
</div>
</div>
<TabGroup
Expand Down
8 changes: 8 additions & 0 deletions keep-ui/app/frigade-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,20 @@

import * as Frigade from "@frigade/react";
import { useHydratedSession as useSession } from "@/shared/lib/hooks/useHydratedSession";
import {useConfig} from "@/utils/hooks/useConfig";
export const FrigadeProvider = ({
children,
}: {
children: React.ReactNode;
}) => {
const { data: session } = useSession();
const { data: config } = useConfig();

if (!config || config.FRIGADE_DISABLED === "true") {
return <>
{children}
</>;
}
return (
<Frigade.Provider
apiKey="api_public_6BKR7bUv0YZ5dqnjLGeHpRWCHaDWeb5cVobG3A9YkW0gOgafOEBvtJGZgvhp8PGb"
Expand Down
4 changes: 3 additions & 1 deletion keep-ui/components/navbar/UserInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,15 @@ type UserInfoProps = {
};

export const UserInfo = ({ session }: UserInfoProps) => {
const { data: config } = useConfig();

const { flow } = Frigade.useFlow(ONBOARDING_FLOW_ID);
const [isOnboardingOpen, setIsOnboardingOpen] = useState(false);

return (
<>
<ul className="space-y-2 p-2">
{flow?.isCompleted === false && (
{!config?.FRIGADE_DISABLED && flow?.isCompleted === false && (
<li>
<Frigade.ProgressBadge
flowId={ONBOARDING_FLOW_ID}
Expand Down
1 change: 1 addition & 0 deletions keep-ui/shared/lib/server/getConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export function getConfig(): InternalConfig {
POSTHOG_DISABLED: process.env.POSTHOG_DISABLED,
POSTHOG_HOST: process.env.POSTHOG_HOST,
SENTRY_DISABLED: process.env.SENTRY_DISABLED,
FRIGADE_DISABLED: process.env.FRIGADE_DISABLED,
READ_ONLY: process.env.KEEP_READ_ONLY === "true",
OPEN_AI_API_KEY_SET: !!process.env.OPEN_AI_API_KEY || !!process.env.OPENAI_API_KEY,
// NOISY ALERTS DISABLED BY DEFAULT TO SPARE SPACE ON THE TABLE
Expand Down
2 changes: 2 additions & 0 deletions keep-ui/types/internal-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@ export interface InternalConfig {

// NOISY ALERTS ENABLED
NOISY_ALERTS_ENABLED: boolean;

FRIGADE_DISABLED: string | undefined;
}
2 changes: 2 additions & 0 deletions tests/e2e_tests/docker-compose-e2e-mysql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ services:
- AUTH_TYPE=NO_AUTH
- API_URL=http://keep-backend:8080
- POSTHOG_DISABLED=true
- FRIGADE_DISABLED=true
- SENTRY_DISABLED=true

keep-backend:
Expand All @@ -38,6 +39,7 @@ services:
- AUTH_TYPE=NO_AUTH
- DATABASE_CONNECTION_STRING=mysql+pymysql://root:keep@keep-database:3306/keep
- POSTHOG_DISABLED=true
- FRIGADE_DISABLED=true
- SECRET_MANAGER_DIRECTORY=/app
- SQLALCHEMY_WARN_20=1
depends_on:
Expand Down
2 changes: 2 additions & 0 deletions tests/e2e_tests/docker-compose-e2e-postgres.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ services:
- AUTH_TYPE=NO_AUTH
- API_URL=http://keep-backend:8080
- POSTHOG_DISABLED=true
- FRIGADE_DISABLED=true
- SENTRY_DISABLED=true

keep-backend:
Expand All @@ -36,6 +37,7 @@ services:
- AUTH_TYPE=NO_AUTH
- DATABASE_CONNECTION_STRING=postgresql+psycopg2://keepuser:keeppassword@keep-database:5432/keepdb
- POSTHOG_DISABLED=true
- FRIGADE_DISABLED=true
- SECRET_MANAGER_DIRECTORY=/app
- SQLALCHEMY_WARN_20=1
depends_on:
Expand Down
2 changes: 2 additions & 0 deletions tests/e2e_tests/docker-compose-e2e-redis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ services:
- AUTH_TYPE=NO_AUTH
- API_URL=http://keep-backend:8080
- POSTHOG_DISABLED=true
- FRIGADE_DISABLED=true
- SENTRY_DISABLED=true
depends_on:
- keep-backend
Expand All @@ -24,6 +25,7 @@ services:
- AUTH_TYPE=NO_AUTH
- DATABASE_CONNECTION_STRING=sqlite:///./newdb.db?check_same_thread=False
- POSTHOG_DISABLED=true
- FRIGADE_DISABLED=true
- SECRET_MANAGER_DIRECTORY=/appֿ
- REDIS=true
- REDIS_HOST=keep-arq-redis
Expand Down
Loading