Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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: 0 additions & 1 deletion .env.development
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,5 @@ SOURCEBOT_TELEMETRY_DISABLED=true # Disables telemetry collection

# CONFIG_MAX_REPOS_NO_TOKEN=
NODE_ENV=development
# SOURCEBOT_TENANCY_MODE=single

DEBUG_WRITE_CHAT_MESSAGES_TO_FILE=true
27 changes: 0 additions & 27 deletions docs/docs/configuration/tenancy.mdx

This file was deleted.

2 changes: 0 additions & 2 deletions packages/shared/src/env.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { readFile } from 'fs/promises';
import stripJsonComments from "strip-json-comments";
import { z } from "zod";
import { getTokenFromConfig } from "./crypto.js";
import { tenancyModeSchema } from "./types.js";

// Booleans are specified as 'true' or 'false' strings.
const booleanSchema = z.enum(["true", "false"]);
Expand Down Expand Up @@ -182,7 +181,6 @@ const options = {
DATABASE_NAME: z.string().optional(),
DATABASE_ARGS: z.string().optional(),

SOURCEBOT_TENANCY_MODE: tenancyModeSchema.default("single"),
CONFIG_PATH: z.string(),

// Misc UI flags
Expand Down
1 change: 0 additions & 1 deletion packages/shared/src/index.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export type {
export {
repoMetadataSchema,
repoIndexingJobMetadataSchema,
tenancyModeSchema,
} from "./types.js";
export {
base64Decode,
Expand Down
2 changes: 0 additions & 2 deletions packages/shared/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,4 @@ export const repoIndexingJobMetadataSchema = z.object({

export type RepoIndexingJobMetadata = z.infer<typeof repoIndexingJobMetadataSchema>;

export const tenancyModeSchema = z.enum(["multi", "single"]);

export type IdentityProviderType = IdentityProviderConfig['provider'];
11 changes: 0 additions & 11 deletions packages/web/src/app/[domain]/components/navigationMenu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@ import { auth } from "@/auth";
import { Button } from "@/components/ui/button";
import { NavigationMenu as NavigationMenuBase } from "@/components/ui/navigation-menu";
import { Separator } from "@/components/ui/separator";
import { env } from "@sourcebot/shared";
import { ServiceErrorException } from "@/lib/serviceError";
import { isServiceError } from "@/lib/utils";
import { OrgRole, RepoIndexingJobStatus, RepoIndexingJobType } from "@sourcebot/db";
import Link from "next/link";
import { OrgSelector } from "../orgSelector";
import { MeControlDropdownMenu } from "../meControlDropdownMenu";
import WhatsNewIndicator from "../whatsNewIndicator";
import { NavigationItems } from "./navigationItems";
Expand Down Expand Up @@ -100,15 +98,6 @@ export const NavigationMenu = async ({
/>
</Link>

{env.SOURCEBOT_TENANCY_MODE === 'multi' && (
<>
<OrgSelector
domain={domain}
/>
<Separator orientation="vertical" className="h-6 mx-2" />
</>
)}

<NavigationMenuBase>
<NavigationItems
domain={domain}
Expand Down
38 changes: 0 additions & 38 deletions packages/web/src/app/[domain]/components/orgSelector/index.tsx

This file was deleted.

36 changes: 0 additions & 36 deletions packages/web/src/app/[domain]/components/orgSelector/orgIcon.tsx

This file was deleted.

This file was deleted.

21 changes: 3 additions & 18 deletions packages/web/src/initialize.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { createGuestUser } from '@/lib/authUtils';
import { SOURCEBOT_SUPPORT_EMAIL } from "@/lib/constants";
import { prisma } from "@/prisma";
import { OrgRole } from '@sourcebot/db';
import { createLogger, env, hasEntitlement, loadConfig } from "@sourcebot/shared";
Expand Down Expand Up @@ -35,7 +34,7 @@ const pruneOldGuestUser = async () => {
}
}

const initSingleTenancy = async () => {
const init = async () => {
// This is needed because v4 introduces the GUEST org role as well as making authentication required.
// To keep things simple, we'll just delete the old guest user if it exists in the DB
await pruneOldGuestUser();
Expand Down Expand Up @@ -66,7 +65,7 @@ const initSingleTenancy = async () => {
// search contexts that may be present in the DB. This could happen if a deployment had
// the entitlement, synced search contexts, and then no longer had the entitlement
const hasSearchContextEntitlement = hasEntitlement("search-contexts")
if(!hasSearchContextEntitlement) {
if (!hasSearchContextEntitlement) {
await prisma.searchContext.deleteMany({
where: {
orgId: SINGLE_TENANT_ORG_ID,
Expand Down Expand Up @@ -115,20 +114,6 @@ const initSingleTenancy = async () => {
}
}

const initMultiTenancy = async () => {
const hasMultiTenancyEntitlement = hasEntitlement("multi-tenancy");
if (!hasMultiTenancyEntitlement) {
logger.error(`SOURCEBOT_TENANCY_MODE is set to ${env.SOURCEBOT_TENANCY_MODE} but your license doesn't have multi-tenancy entitlement. Please contact ${SOURCEBOT_SUPPORT_EMAIL} to request a license upgrade.`);
process.exit(1);
}
}

(async () => {
if (env.SOURCEBOT_TENANCY_MODE === 'single') {
await initSingleTenancy();
} else if (env.SOURCEBOT_TENANCY_MODE === 'multi') {
await initMultiTenancy();
} else {
throw new Error(`Invalid SOURCEBOT_TENANCY_MODE: ${env.SOURCEBOT_TENANCY_MODE}`);
}
await init();
})();
2 changes: 0 additions & 2 deletions packages/web/src/lib/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { z } from "zod";
import { listReposResponseSchema, getVersionResponseSchema, repositoryQuerySchema, searchContextQuerySchema, listReposQueryParamsSchema } from "./schemas";
import { tenancyModeSchema } from "@sourcebot/shared";

export type KeymapType = "default" | "vim";

Expand All @@ -26,7 +25,6 @@ export type NewsItem = {
read?: boolean;
}

export type TenancyMode = z.infer<typeof tenancyModeSchema>;
export type RepositoryQuery = z.infer<typeof repositoryQuerySchema>;
export type SearchContextQuery = z.infer<typeof searchContextQuerySchema>;
export type ListReposResponse = z.infer<typeof listReposResponseSchema>;
Expand Down
Loading