Merge branch 'plugins-dev-experience' of github.com:Budibase/budibase into plugins-dev-experience

This commit is contained in:
Michael Drury 2022-08-16 15:44:05 +01:00
commit a19790e93e
4 changed files with 18 additions and 6 deletions

View File

@ -77,6 +77,11 @@ http {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
} }
location /ws {
proxy_pass http://{{ address }}:3000;
rewrite ^/ws(.*)$ /$1 break;
}
location / { location / {
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

View File

@ -1,15 +1,22 @@
import { svelte } from "@sveltejs/vite-plugin-svelte" import { svelte } from "@sveltejs/vite-plugin-svelte"
import replace from "@rollup/plugin-replace" import replace from "@rollup/plugin-replace"
import { defineConfig, loadEnv } from "vite"
import path from "path" import path from "path"
export default ({ mode }) => { export default defineConfig(({ mode }) => {
const isProduction = mode === "production" const isProduction = mode === "production"
const env = loadEnv(mode, process.cwd())
return { return {
server: { server: {
fs: { fs: {
strict: false, strict: false,
}, },
hmr: {
protocol: "wss",
clientPort: env.VITE_HMR_CLIENT_PORT || 3000,
path: env.VITE_HMR_PATH || "/"
}
}, },
base: "/builder/", base: "/builder/",
build: { build: {
@ -79,4 +86,4 @@ export default ({ mode }) => {
], ],
}, },
} }
} })

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]

View File

@ -10,3 +10,4 @@ declare module "@budibase/backend-core/sessions"
declare module "@budibase/backend-core/encryption" declare module "@budibase/backend-core/encryption"
declare module "@budibase/backend-core/utils" declare module "@budibase/backend-core/utils"
declare module "@budibase/backend-core/redis" declare module "@budibase/backend-core/redis"
declare module "@budibase/backend-core/objectStore"