Skip to content

Commit c49bbae

Browse files
committed
fix build errors
1 parent 697fc67 commit c49bbae

File tree

5 files changed

+14
-22
lines changed

5 files changed

+14
-22
lines changed

packages/backend/src/constants.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ export const DEFAULT_SETTINGS: Settings = {
1414
maxRepoIndexingJobConcurrency: 8,
1515
maxRepoGarbageCollectionJobConcurrency: 8,
1616
repoGarbageCollectionGracePeriodMs: 10 * 1000, // 10 seconds
17-
repoIndexTimeoutMs: 1000 * 60 * 60 * 2 // 2 hours
17+
repoIndexTimeoutMs: 1000 * 60 * 60 * 2, // 2 hours
18+
enablePublicAccess: false // deprected, use FORCE_ENABLE_ANONYMOUS_ACCESS instead
1819
}

packages/web/src/app/components/anonymousAccessToggle.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export function AnonymousAccessToggle({ hasAnonymousAccessEntitlement, anonymous
7878
/>
7979
</svg>
8080
<span>
81-
Your current plan doesn't allow for anonymous access. Please{" "}
81+
Your current plan doesn&apos;t allow for anonymous access. Please{" "}
8282
<a
8383
href="https://www.sourcebot.dev/contact"
8484
target="_blank"

packages/web/src/app/onboard/page.tsx

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,8 @@ import { LogoutEscapeHatch } from "@/app/components/logoutEscapeHatch";
1616
import { redirect } from "next/navigation";
1717
import { BetweenHorizontalStart, GitBranchIcon, LockIcon } from "lucide-react";
1818
import { hasEntitlement } from "@sourcebot/shared";
19-
import { getAnonymousAccessStatus } from "@/actions";
2019
import { env } from "@/env.mjs";
2120
import { GcpIapAuth } from "@/app/[domain]/components/gcpIapAuth";
22-
import { headers } from "next/headers";
23-
import { getBaseUrl, createInviteLink, isServiceError } from "@/lib/utils";
2421

2522
interface OnboardingProps {
2623
searchParams?: { step?: string };
@@ -50,16 +47,6 @@ export default async function Onboarding({ searchParams }: OnboardingProps) {
5047
return <div>Error loading organization</div>;
5148
}
5249

53-
// Get anonymous access status
54-
const anonymousAccessEntitlement = hasEntitlement("anonymous-access");
55-
const anonymousAccessStatus = await getAnonymousAccessStatus(SINGLE_TENANT_ORG_DOMAIN);
56-
const anonymousAccessEnabled = anonymousAccessEntitlement && !isServiceError(anonymousAccessStatus) && anonymousAccessStatus;
57-
58-
// Get the current URL to construct the full invite link
59-
const headersList = headers();
60-
const baseUrl = getBaseUrl(headersList);
61-
const inviteLink = createInviteLink(baseUrl, org.inviteLinkId);
62-
6350
if (org && org.isOnboarded) {
6451
redirect('/');
6552
}
@@ -161,7 +148,7 @@ export default async function Onboarding({ searchParams }: OnboardingProps) {
161148
title: "Configure Access Settings",
162149
subtitle: (
163150
<>
164-
Set up your organization's access settings.{" "}
151+
Set up your organization&apos;s access settings.{" "}
165152
<a
166153
href="https://docs.sourcebot.dev/docs/configuration/auth/access-settings"
167154
target="_blank"

packages/web/src/env.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ export const env = createEnv({
2020
ZOEKT_MAX_WALL_TIME_MS: numberSchema.default(10000),
2121

2222
// Auth
23+
FORCE_ENABLE_ANONYMOUS_ACCESS: booleanSchema.default('false'),
24+
2325
AUTH_SECRET: z.string(),
2426
AUTH_URL: z.string().url(),
2527
AUTH_CREDENTIALS_LOGIN_ENABLED: booleanSchema.default('true'),
@@ -80,7 +82,6 @@ export const env = createEnv({
8082

8183
// Misc UI flags
8284
SECURITY_CARD_ENABLED: booleanSchema.default('false'),
83-
FORCE_ENABLE_ANONYMOUS_ACCESS: booleanSchema.default('false'),
8485

8586
// EE License
8687
SOURCEBOT_EE_LICENSE_KEY: z.string().optional(),

packages/web/src/initialize.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { SOURCEBOT_SUPPORT_EMAIL } from "@/lib/constants";
1111
import { createLogger } from "@sourcebot/logger";
1212
import { createGuestUser } from '@/lib/authUtils';
1313
import { getOrgFromDomain } from './data/org';
14+
import { getOrgMetadata } from './types';
1415

1516
const logger = createLogger('web-initialize');
1617

@@ -113,14 +114,16 @@ const syncDeclarativeConfig = async (configPath: string) => {
113114
} else {
114115
const org = await getOrgFromDomain(SINGLE_TENANT_ORG_DOMAIN);
115116
if (org) {
116-
const currentMetadata = org.metadata ? org.metadata as any : {};
117+
const currentMetadata = getOrgMetadata(org);
118+
const mergedMetadata = {
119+
...(currentMetadata ?? {}),
120+
anonymousAccessEnabled: true,
121+
};
122+
117123
await prisma.org.update({
118124
where: { id: org.id },
119125
data: {
120-
metadata: {
121-
...currentMetadata,
122-
anonymousAccessEnabled: true
123-
}
126+
metadata: mergedMetadata,
124127
},
125128
});
126129
logger.info(`Anonymous access enabled via FORCE_ENABLE_ANONYMOUS_ACCESS environment variable`);

0 commit comments

Comments
 (0)