fix: hide license settings in cloud environments

This commit is contained in:
bkellam 2025-05-28 16:42:59 -07:00
parent 60a3528394
commit 0568b03a80
2 changed files with 13 additions and 5 deletions

View file

@ -11,6 +11,7 @@ import { getMe, getOrgAccountRequests } from "@/actions";
import { ServiceErrorException } from "@/lib/serviceError";
import { getOrgFromDomain } from "@/data/org";
import { OrgRole } from "@prisma/client";
import { env } from "@/env.mjs";
export const metadata: Metadata = {
title: "Settings",
@ -84,10 +85,12 @@ export default async function SettingsLayout({
title: "API Keys",
href: `/${domain}/settings/apiKeys`,
},
{
title: "License",
href: `/${domain}/settings/license`,
}
...(env.NEXT_PUBLIC_SOURCEBOT_CLOUD_ENVIRONMENT === undefined ? [
{
title: "License",
href: `/${domain}/settings/license`,
}
] : []),
]
return (

View file

@ -3,7 +3,8 @@ import { Button } from "@/components/ui/button";
import { Info, Mail } from "lucide-react";
import { getOrgMembers } from "@/actions";
import { isServiceError } from "@/lib/utils";
import { ServiceErrorException } from "@/lib/serviceError";
import { notFound, ServiceErrorException } from "@/lib/serviceError";
import { env } from "@/env.mjs";
interface LicensePageProps {
params: {
@ -12,6 +13,10 @@ interface LicensePageProps {
}
export default async function LicensePage({ params: { domain } }: LicensePageProps) {
if (env.NEXT_PUBLIC_SOURCEBOT_CLOUD_ENVIRONMENT !== undefined) {
notFound();
}
const licenseKey = await getLicenseKey();
const entitlements = await getEntitlements();
const plan = await getPlan();