1
0
Fork 0
mirror of synced 2024-06-27 18:40:42 +12:00

Only watch plugins in single tenant envs

This commit is contained in:
Andrew Kingston 2022-08-16 14:02:51 +00:00
parent ddb47a7865
commit 2a6719d3ac

View file

@ -25,7 +25,7 @@ import * as migrations from "./migrations"
import { events, installation, tenancy } from "@budibase/backend-core"
import { createAdminUser, getChecklist } from "./utilities/workerRequests"
import { processPlugin } from "./api/controllers/plugin"
import { getGlobalDB } from "@budibase/backend-core/tenancy"
import { DEFAULT_TENANT_ID } from "@budibase/backend-core/constants"
const app = new Koa()
@ -138,7 +138,7 @@ module.exports = server.listen(env.PORT || 0, async () => {
}
// monitor plugin directory if required
if (env.SELF_HOSTED && env.PLUGINS_DIR && fs.existsSync(env.PLUGINS_DIR)) {
if (env.SELF_HOSTED && !env.MULTI_TENANCY && env.PLUGINS_DIR && fs.existsSync(env.PLUGINS_DIR)) {
const watchPath = path.join(env.PLUGINS_DIR, "./**/dist/*.tar.gz")
chokidar
.watch(watchPath, {
@ -146,8 +146,7 @@ module.exports = server.listen(env.PORT || 0, async () => {
awaitWriteFinish: true,
})
.on("all", async (event: string, path: string) => {
const tenantId = tenancy.getTenantId()
await tenancy.doInTenant(tenantId, async () => {
await tenancy.doInTenant(DEFAULT_TENANT_ID, async () => {
try {
const split = path.split("/")
const name = split[split.length - 1]