2023-08-17 18:44:59 +02:00
|
|
|
import { features } from "@budibase/backend-core"
|
2023-08-17 17:39:25 +02:00
|
|
|
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
|
|
|
|
)
|
2023-08-17 17:39:25 +02:00
|
|
|
|
|
|
|
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)
|
|
|
|
}
|