Skip to content

Commit 63b8a32

Browse files
committed
fix self-hosted v3 feature gate
1 parent 41e8ab0 commit 63b8a32

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

apps/webapp/app/features.server.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function isManagedCloud(host: string): boolean {
1616
);
1717
}
1818

19-
export function featuresForHost(host: string): TriggerFeatures {
19+
function featuresForHost(host: string): TriggerFeatures {
2020
return {
2121
isManagedCloud: isManagedCloud(host),
2222
v3Enabled: env.V3_ENABLED === "true",
@@ -26,12 +26,9 @@ export function featuresForHost(host: string): TriggerFeatures {
2626

2727
export function featuresForRequest(request: Request): TriggerFeatures {
2828
const url = requestUrl(request);
29-
30-
return featuresForHost(url.host);
29+
return featuresForUrl(url);
3130
}
3231

33-
export function featuresForUrl(urlString: string): TriggerFeatures {
34-
const url = new URL(urlString);
35-
32+
export function featuresForUrl(url: URL): TriggerFeatures {
3633
return featuresForHost(url.host);
3734
}

apps/webapp/app/models/organization.server.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@ import type {
88
import { customAlphabet } from "nanoid";
99
import slug from "slug";
1010
import { prisma, PrismaClientOrTransaction } from "~/db.server";
11-
import { createProject } from "./project.server";
1211
import { generate } from "random-words";
1312
import { createApiKeyForEnv, createPkApiKeyForEnv, envSlug } from "./api-key.server";
1413
import { env } from "~/env.server";
15-
import { featuresForHost } from "~/features.server";
14+
import { featuresForUrl } from "~/features.server";
1615

1716
export type { Organization };
1817

@@ -53,7 +52,7 @@ export async function createOrganization(
5352
);
5453
}
5554

56-
const features = featuresForHost(env.APP_ORIGIN);
55+
const features = featuresForUrl(new URL(env.APP_ORIGIN));
5756

5857
const organization = await prisma.organization.create({
5958
data: {

0 commit comments

Comments
 (0)