Merge pull request #7949 from Budibase/fix/plugin-multitenancy
Tenancy awareness for plugin bucket
This commit is contained in:
commit
5b2e0f6bd8
|
@ -226,6 +226,10 @@ export const getAppId = () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const isTenancyEnabled = () => {
|
||||||
|
return env.MULTI_TENANCY
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Opens the app database based on whatever the request
|
* Opens the app database based on whatever the request
|
||||||
* contained, dev or prod.
|
* contained, dev or prod.
|
||||||
|
|
|
@ -16,6 +16,15 @@ if (!LOADED && isDev() && !isTest()) {
|
||||||
LOADED = true
|
LOADED = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const DefaultBucketName = {
|
||||||
|
BACKUPS: "backups",
|
||||||
|
APPS: "prod-budi-app-assets",
|
||||||
|
TEMPLATES: "templates",
|
||||||
|
GLOBAL: "global",
|
||||||
|
CLOUD: "prod-budi-tenant-uploads",
|
||||||
|
PLUGINS: "plugins",
|
||||||
|
}
|
||||||
|
|
||||||
const env = {
|
const env = {
|
||||||
isTest,
|
isTest,
|
||||||
isDev,
|
isDev,
|
||||||
|
@ -45,13 +54,17 @@ const env = {
|
||||||
POSTHOG_TOKEN: process.env.POSTHOG_TOKEN,
|
POSTHOG_TOKEN: process.env.POSTHOG_TOKEN,
|
||||||
ENABLE_ANALYTICS: process.env.ENABLE_ANALYTICS,
|
ENABLE_ANALYTICS: process.env.ENABLE_ANALYTICS,
|
||||||
TENANT_FEATURE_FLAGS: process.env.TENANT_FEATURE_FLAGS,
|
TENANT_FEATURE_FLAGS: process.env.TENANT_FEATURE_FLAGS,
|
||||||
BACKUPS_BUCKET_NAME: process.env.BACKUPS_BUCKET_NAME || "backups",
|
BACKUPS_BUCKET_NAME:
|
||||||
APPS_BUCKET_NAME: process.env.APPS_BUCKET_NAME || "prod-budi-app-assets",
|
process.env.BACKUPS_BUCKET_NAME || DefaultBucketName.BACKUPS,
|
||||||
TEMPLATES_BUCKET_NAME: process.env.TEMPLATES_BUCKET_NAME || "templates",
|
APPS_BUCKET_NAME: process.env.APPS_BUCKET_NAME || DefaultBucketName.APPS,
|
||||||
GLOBAL_BUCKET_NAME: process.env.GLOBAL_BUCKET_NAME || "global",
|
TEMPLATES_BUCKET_NAME:
|
||||||
|
process.env.TEMPLATES_BUCKET_NAME || DefaultBucketName.TEMPLATES,
|
||||||
|
GLOBAL_BUCKET_NAME:
|
||||||
|
process.env.GLOBAL_BUCKET_NAME || DefaultBucketName.GLOBAL,
|
||||||
GLOBAL_CLOUD_BUCKET_NAME:
|
GLOBAL_CLOUD_BUCKET_NAME:
|
||||||
process.env.GLOBAL_CLOUD_BUCKET_NAME || "prod-budi-tenant-uploads",
|
process.env.GLOBAL_CLOUD_BUCKET_NAME || DefaultBucketName.CLOUD,
|
||||||
PLUGIN_BUCKET_NAME: process.env.PLUGIN_BUCKET_NAME || "plugins",
|
PLUGIN_BUCKET_NAME:
|
||||||
|
process.env.PLUGIN_BUCKET_NAME || DefaultBucketName.PLUGINS,
|
||||||
USE_COUCH: process.env.USE_COUCH || true,
|
USE_COUCH: process.env.USE_COUCH || true,
|
||||||
DISABLE_DEVELOPER_LICENSE: process.env.DISABLE_DEVELOPER_LICENSE,
|
DISABLE_DEVELOPER_LICENSE: process.env.DISABLE_DEVELOPER_LICENSE,
|
||||||
DEFAULT_LICENSE: process.env.DEFAULT_LICENSE,
|
DEFAULT_LICENSE: process.env.DEFAULT_LICENSE,
|
||||||
|
|
|
@ -2,6 +2,11 @@ const { join } = require("path")
|
||||||
const { tmpdir } = require("os")
|
const { tmpdir } = require("os")
|
||||||
const env = require("../environment")
|
const env = require("../environment")
|
||||||
|
|
||||||
|
/****************************************************
|
||||||
|
* NOTE: When adding a new bucket - name *
|
||||||
|
* sure that S3 usages (like budibase-infra) *
|
||||||
|
* have been updated to have a unique bucket name. *
|
||||||
|
****************************************************/
|
||||||
exports.ObjectStoreBuckets = {
|
exports.ObjectStoreBuckets = {
|
||||||
BACKUPS: env.BACKUPS_BUCKET_NAME,
|
BACKUPS: env.BACKUPS_BUCKET_NAME,
|
||||||
APPS: env.APPS_BUCKET_NAME,
|
APPS: env.APPS_BUCKET_NAME,
|
||||||
|
|
Loading…
Reference in New Issue