2022-11-16 18:24:13 +01:00
|
|
|
import env from "../environment"
|
|
|
|
import { BBContext } from "@budibase/types"
|
|
|
|
|
2021-01-14 18:01:31 +01:00
|
|
|
// if added as a middleware will stop requests unless builder is in self host mode
|
|
|
|
// or cloud is in self host
|
2022-11-16 18:24:13 +01:00
|
|
|
module.exports = async (ctx: BBContext, next: any) => {
|
2021-03-24 19:21:23 +01:00
|
|
|
if (env.SELF_HOSTED) {
|
2021-01-14 18:01:31 +01:00
|
|
|
await next()
|
|
|
|
return
|
|
|
|
}
|
|
|
|
ctx.throw(400, "Endpoint unavailable in cloud hosting.")
|
|
|
|
}
|