1
0
Fork 0
mirror of synced 2024-09-21 03:43:21 +12:00
budibase/packages/server/src/features.ts

32 lines
687 B
TypeScript
Raw Normal View History

2023-08-18 04:44:59 +12:00
import { features } from "@budibase/backend-core"
import env from "./environment"
enum AppFeature {
API = "api",
AUTOMATIONS = "automations",
}
2023-08-18 04:44:59 +12:00
const featureList = features.processFeatureEnvVar<AppFeature>(
2023-08-18 21:56:13 +12:00
Object.values(AppFeature),
2023-08-18 04:44:59 +12: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)
}
export function printFeatures() {
if (!env.APP_FEATURES) {
return
}
console.log(`**** APP FEATURES SET: ${featureList.join(", ")} ****`)
}