budibase/packages/server/src/features.ts

25 lines
537 B
TypeScript
Raw Normal View History

2023-08-17 18:44:59 +02:00
import { features } from "@budibase/backend-core"
import env from "./environment"
enum AppFeature {
API = "api",
AUTOMATIONS = "automations",
}
2023-08-17 18:44:59 +02:00
const featureList = features.processFeatureEnvVar<AppFeature>(
2023-08-18 11:56:13 +02:00
Object.values(AppFeature),
2023-08-17 18:44:59 +02:00
env.APP_FEATURES
)
export function isFeatureEnabled(feature: AppFeature) {
return featureList.includes(feature)
}
export function automationsEnabled() {
return featureList.includes(AppFeature.AUTOMATIONS)
}
export function apiEnabled() {
return featureList.includes(AppFeature.API)
}