1
0
Fork 0
mirror of synced 2024-06-20 19:30:28 +12:00
budibase/packages/server/src/middleware/selfhost.ts
2022-11-17 13:31:54 +00:00

13 lines
355 B
TypeScript

import env from "../environment"
import { BBContext } from "@budibase/types"
// if added as a middleware will stop requests unless builder is in self host mode
// or cloud is in self host
export = async (ctx: BBContext, next: any) => {
if (env.SELF_HOSTED) {
await next()
return
}
ctx.throw(400, "Endpoint unavailable in cloud hosting.")
}