1
0
Fork 0
mirror of synced 2024-10-01 01:28:51 +13: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 { events, installation, tenancy } from "@budibase/backend-core"
import { createAdminUser, getChecklist } from "./utilities/workerRequests" import { createAdminUser, getChecklist } from "./utilities/workerRequests"
import { processPlugin } from "./api/controllers/plugin" 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() const app = new Koa()
@ -138,7 +138,7 @@ module.exports = server.listen(env.PORT || 0, async () => {
} }
// monitor plugin directory if required // 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") const watchPath = path.join(env.PLUGINS_DIR, "./**/dist/*.tar.gz")
chokidar chokidar
.watch(watchPath, { .watch(watchPath, {
@ -146,8 +146,7 @@ module.exports = server.listen(env.PORT || 0, async () => {
awaitWriteFinish: true, awaitWriteFinish: true,
}) })
.on("all", async (event: string, path: string) => { .on("all", async (event: string, path: string) => {
const tenantId = tenancy.getTenantId() await tenancy.doInTenant(DEFAULT_TENANT_ID, async () => {
await tenancy.doInTenant(tenantId, async () => {
try { try {
const split = path.split("/") const split = path.split("/")
const name = split[split.length - 1] const name = split[split.length - 1]