add const for temp bucket

This commit is contained in:
Peter Clement 2024-03-14 12:31:16 +00:00
parent d473618227
commit 24d1e4af63
3 changed files with 8 additions and 5 deletions

View File

@ -29,6 +29,7 @@ const DefaultBucketName = {
TEMPLATES: "templates",
GLOBAL: "global",
PLUGINS: "plugins",
TEMP: "tmp-file-attachments",
}
const selfHosted = !!parseInt(process.env.SELF_HOSTED || "")
@ -146,6 +147,7 @@ const environment = {
process.env.GLOBAL_BUCKET_NAME || DefaultBucketName.GLOBAL,
PLUGIN_BUCKET_NAME:
process.env.PLUGIN_BUCKET_NAME || DefaultBucketName.PLUGINS,
TEMP_BUCKET_NAME: process.env.TEMP_BUCKET_NAME || DefaultBucketName.TEMP,
USE_COUCH: process.env.USE_COUCH || true,
MOCK_REDIS: process.env.MOCK_REDIS,
DEFAULT_LICENSE: process.env.DEFAULT_LICENSE,

View File

@ -15,6 +15,7 @@ export const ObjectStoreBuckets = {
TEMPLATES: env.TEMPLATES_BUCKET_NAME,
GLOBAL: env.GLOBAL_BUCKET_NAME,
PLUGINS: env.PLUGIN_BUCKET_NAME,
TEMP: env.TEMP_BUCKET_NAME,
}
const bbTmp = join(tmpdir(), ".budibase")

View File

@ -146,18 +146,18 @@ class RestIntegration implements IntegrationBase {
: ""
const processedFileName = `${v4()}.${fileExtension}`
const key = `${context.getProdAppId()}/attachments/${processedFileName}`
const key = `${context.getProdAppId()}/${processedFileName}`
const bucket = objectStore.ObjectStoreBuckets.TEMP
await objectStore.upload({
bucket: objectStore.ObjectStoreBuckets.APPS,
bucket: bucket,
filename: key,
body: Buffer.from(responseBuffer),
ttl: 1800,
ttl: true,
})
presignedUrl = await objectStore.getPresignedUrl("test", key, 600)
presignedUrl = await objectStore.getPresignedUrl(bucket, key, 600)
raw = Buffer.from(responseBuffer).toString()
return {
data: {
size: responseBuffer.byteLength,