Merge pull request #8562 from Budibase/configurable-cdn-master
Configurable cdn master
This commit is contained in:
commit
741178ab02
|
@ -158,6 +158,8 @@ spec:
|
||||||
- name: ELASTIC_APM_SERVER_URL
|
- name: ELASTIC_APM_SERVER_URL
|
||||||
value: {{ .Values.globals.elasticApmServerUrl | quote }}
|
value: {{ .Values.globals.elasticApmServerUrl | quote }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
- name: CDN_URL
|
||||||
|
value: {{ .Values.globals.cdnUrl }}
|
||||||
|
|
||||||
image: budibase/apps:{{ .Values.globals.appVersion }}
|
image: budibase/apps:{{ .Values.globals.appVersion }}
|
||||||
imagePullPolicy: Always
|
imagePullPolicy: Always
|
||||||
|
|
|
@ -147,6 +147,8 @@ spec:
|
||||||
- name: ELASTIC_APM_SERVER_URL
|
- name: ELASTIC_APM_SERVER_URL
|
||||||
value: {{ .Values.globals.elasticApmServerUrl | quote }}
|
value: {{ .Values.globals.elasticApmServerUrl | quote }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
- name: CDN_URL
|
||||||
|
value: {{ .Values.globals.cdnUrl }}
|
||||||
|
|
||||||
image: budibase/worker:{{ .Values.globals.appVersion }}
|
image: budibase/worker:{{ .Values.globals.appVersion }}
|
||||||
imagePullPolicy: Always
|
imagePullPolicy: Always
|
||||||
|
|
|
@ -98,6 +98,7 @@ globals:
|
||||||
# if createSecrets is set to false, you can hard-code your secrets here
|
# if createSecrets is set to false, you can hard-code your secrets here
|
||||||
internalApiKey: ""
|
internalApiKey: ""
|
||||||
jwtSecret: ""
|
jwtSecret: ""
|
||||||
|
cdnUrl: ""
|
||||||
|
|
||||||
smtp:
|
smtp:
|
||||||
enabled: false
|
enabled: false
|
||||||
|
|
|
@ -46,6 +46,7 @@ module.exports = {
|
||||||
AWS_REGION: process.env.AWS_REGION,
|
AWS_REGION: process.env.AWS_REGION,
|
||||||
MINIO_ACCESS_KEY: process.env.MINIO_ACCESS_KEY,
|
MINIO_ACCESS_KEY: process.env.MINIO_ACCESS_KEY,
|
||||||
MINIO_SECRET_KEY: process.env.MINIO_SECRET_KEY,
|
MINIO_SECRET_KEY: process.env.MINIO_SECRET_KEY,
|
||||||
|
CDN_URL: process.env.CDN_URL || "https://cdn.budi.live",
|
||||||
REDIS_URL: process.env.REDIS_URL,
|
REDIS_URL: process.env.REDIS_URL,
|
||||||
REDIS_PASSWORD: process.env.REDIS_PASSWORD,
|
REDIS_PASSWORD: process.env.REDIS_PASSWORD,
|
||||||
INTERNAL_API_KEY: process.env.INTERNAL_API_KEY,
|
INTERNAL_API_KEY: process.env.INTERNAL_API_KEY,
|
||||||
|
|
|
@ -5,8 +5,6 @@ const { generateMetadataID } = require("../db/utils")
|
||||||
const Readable = require("stream").Readable
|
const Readable = require("stream").Readable
|
||||||
const { getAppDB } = require("@budibase/backend-core/context")
|
const { getAppDB } = require("@budibase/backend-core/context")
|
||||||
|
|
||||||
const BB_CDN = "https://cdn.budi.live"
|
|
||||||
|
|
||||||
exports.wait = ms => new Promise(resolve => setTimeout(resolve, ms))
|
exports.wait = ms => new Promise(resolve => setTimeout(resolve, ms))
|
||||||
|
|
||||||
exports.isDev = env.isDev
|
exports.isDev = env.isDev
|
||||||
|
@ -40,7 +38,7 @@ exports.objectStoreUrl = () => {
|
||||||
// can use a relative url for this as all goes through the proxy (this is hosted in minio)
|
// can use a relative url for this as all goes through the proxy (this is hosted in minio)
|
||||||
return OBJ_STORE_DIRECTORY
|
return OBJ_STORE_DIRECTORY
|
||||||
} else {
|
} else {
|
||||||
return BB_CDN
|
return env.CDN_URL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ exports.enrichPluginURLs = plugins => {
|
||||||
|
|
||||||
// In self host we need to prefix the path, as the bucket name is not part
|
// In self host we need to prefix the path, as the bucket name is not part
|
||||||
// of the bucket path. In cloud, it's already part of the bucket path.
|
// of the bucket path. In cloud, it's already part of the bucket path.
|
||||||
let jsUrl = cloud ? "https://cdn.budi.live/" : `/${bucket}/`
|
let jsUrl = cloud ? `${env.CDN_URL}/` : `/${bucket}/`
|
||||||
jsUrl += ProPlugins.getBucketPath(plugin.name)
|
jsUrl += ProPlugins.getBucketPath(plugin.name)
|
||||||
jsUrl += jsFileName
|
jsUrl += jsFileName
|
||||||
return { ...plugin, jsUrl }
|
return { ...plugin, jsUrl }
|
||||||
|
|
|
@ -22,8 +22,6 @@ const {
|
||||||
const { events } = require("@budibase/backend-core")
|
const { events } = require("@budibase/backend-core")
|
||||||
const { checkAnyUserExists } = require("../../../utilities/users")
|
const { checkAnyUserExists } = require("../../../utilities/users")
|
||||||
|
|
||||||
const BB_TENANT_CDN = "https://tenants.cdn.budi.live"
|
|
||||||
|
|
||||||
const getEventFns = async (db, config) => {
|
const getEventFns = async (db, config) => {
|
||||||
const fns = []
|
const fns = []
|
||||||
const type = config.type
|
const type = config.type
|
||||||
|
@ -350,7 +348,7 @@ exports.upload = async function (ctx) {
|
||||||
if (env.SELF_HOSTED) {
|
if (env.SELF_HOSTED) {
|
||||||
url = `/${bucket}/${key}`
|
url = `/${bucket}/${key}`
|
||||||
} else {
|
} else {
|
||||||
url = `${BB_TENANT_CDN}/${key}`
|
url = `${env.CDN_URL}/${key}`
|
||||||
}
|
}
|
||||||
|
|
||||||
cfgStructure.config[`${name}`] = url
|
cfgStructure.config[`${name}`] = url
|
||||||
|
|
|
@ -42,6 +42,7 @@ const env = {
|
||||||
ACCOUNT_PORTAL_URL: process.env.ACCOUNT_PORTAL_URL,
|
ACCOUNT_PORTAL_URL: process.env.ACCOUNT_PORTAL_URL,
|
||||||
PLATFORM_URL: process.env.PLATFORM_URL,
|
PLATFORM_URL: process.env.PLATFORM_URL,
|
||||||
APPS_URL: process.env.APPS_URL,
|
APPS_URL: process.env.APPS_URL,
|
||||||
|
CDN_URL: process.env.CDN_URL || "https://tenants.cdn.budi.live",
|
||||||
// ports
|
// ports
|
||||||
// prefer worker port to generic port
|
// prefer worker port to generic port
|
||||||
PORT: process.env.WORKER_PORT || process.env.PORT,
|
PORT: process.env.WORKER_PORT || process.env.PORT,
|
||||||
|
|
Loading…
Reference in New Issue