File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed
Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ export const FEATURE_FLAG = {
99 hasLogsPageAccess : "hasLogsPageAccess" ,
1010 hasAiAccess : "hasAiAccess" ,
1111 hasAiModelsAccess : "hasAiModelsAccess" ,
12+ hasComputeAccess : "hasComputeAccess" ,
1213} as const ;
1314
1415const FeatureFlagCatalog = {
@@ -19,6 +20,7 @@ const FeatureFlagCatalog = {
1920 [ FEATURE_FLAG . hasLogsPageAccess ] : z . coerce . boolean ( ) ,
2021 [ FEATURE_FLAG . hasAiAccess ] : z . coerce . boolean ( ) ,
2122 [ FEATURE_FLAG . hasAiModelsAccess ] : z . coerce . boolean ( ) ,
23+ [ FEATURE_FLAG . hasComputeAccess ] : z . coerce . boolean ( ) ,
2224} ;
2325
2426type FeatureFlagKey = keyof typeof FeatureFlagCatalog ;
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import { ComputeGatewayClient } from "@internal/compute";
22import { env } from "~/env.server" ;
33import { logger } from "~/services/logger.server" ;
44import type { PrismaClientOrTransaction } from "~/db.server" ;
5+ import { FEATURE_FLAG , makeFlag } from "~/v3/featureFlags.server" ;
56
67type TemplateCreationMode = "required" | "shadow" | "skip" ;
78
@@ -28,14 +29,26 @@ export class ComputeTemplateCreationService {
2829 defaultWorkerGroup : {
2930 select : { workloadType : true } ,
3031 } ,
32+ organization : {
33+ select : { featureFlags : true } ,
34+ } ,
3135 } ,
3236 } ) ;
3337
3438 if ( project ?. defaultWorkerGroup ?. workloadType === "MICROVM" ) {
3539 return "required" ;
3640 }
3741
38- // TODO: check private beta feature flag for org
42+ const flag = makeFlag ( prisma ) ;
43+ const hasComputeAccess = await flag ( {
44+ key : FEATURE_FLAG . hasComputeAccess ,
45+ defaultValue : false ,
46+ overrides : ( project ?. organization ?. featureFlags as Record < string , unknown > ) ?? { } ,
47+ } ) ;
48+
49+ if ( hasComputeAccess ) {
50+ return "required" ;
51+ }
3952
4053 const rolloutPct = Number ( env . COMPUTE_TEMPLATE_SHADOW_ROLLOUT_PCT ?? "0" ) ;
4154 if ( rolloutPct > 0 && Math . random ( ) * 100 < rolloutPct ) {
You can’t perform that action at this time.
0 commit comments