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

View file

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