add const for temp bucket
This commit is contained in:
parent
d473618227
commit
24d1e4af63
|
@ -29,6 +29,7 @@ const DefaultBucketName = {
|
||||||
TEMPLATES: "templates",
|
TEMPLATES: "templates",
|
||||||
GLOBAL: "global",
|
GLOBAL: "global",
|
||||||
PLUGINS: "plugins",
|
PLUGINS: "plugins",
|
||||||
|
TEMP: "tmp-file-attachments",
|
||||||
}
|
}
|
||||||
|
|
||||||
const selfHosted = !!parseInt(process.env.SELF_HOSTED || "")
|
const selfHosted = !!parseInt(process.env.SELF_HOSTED || "")
|
||||||
|
@ -146,6 +147,7 @@ const environment = {
|
||||||
process.env.GLOBAL_BUCKET_NAME || DefaultBucketName.GLOBAL,
|
process.env.GLOBAL_BUCKET_NAME || DefaultBucketName.GLOBAL,
|
||||||
PLUGIN_BUCKET_NAME:
|
PLUGIN_BUCKET_NAME:
|
||||||
process.env.PLUGIN_BUCKET_NAME || DefaultBucketName.PLUGINS,
|
process.env.PLUGIN_BUCKET_NAME || DefaultBucketName.PLUGINS,
|
||||||
|
TEMP_BUCKET_NAME: process.env.TEMP_BUCKET_NAME || DefaultBucketName.TEMP,
|
||||||
USE_COUCH: process.env.USE_COUCH || true,
|
USE_COUCH: process.env.USE_COUCH || true,
|
||||||
MOCK_REDIS: process.env.MOCK_REDIS,
|
MOCK_REDIS: process.env.MOCK_REDIS,
|
||||||
DEFAULT_LICENSE: process.env.DEFAULT_LICENSE,
|
DEFAULT_LICENSE: process.env.DEFAULT_LICENSE,
|
||||||
|
|
|
@ -15,6 +15,7 @@ export const ObjectStoreBuckets = {
|
||||||
TEMPLATES: env.TEMPLATES_BUCKET_NAME,
|
TEMPLATES: env.TEMPLATES_BUCKET_NAME,
|
||||||
GLOBAL: env.GLOBAL_BUCKET_NAME,
|
GLOBAL: env.GLOBAL_BUCKET_NAME,
|
||||||
PLUGINS: env.PLUGIN_BUCKET_NAME,
|
PLUGINS: env.PLUGIN_BUCKET_NAME,
|
||||||
|
TEMP: env.TEMP_BUCKET_NAME,
|
||||||
}
|
}
|
||||||
|
|
||||||
const bbTmp = join(tmpdir(), ".budibase")
|
const bbTmp = join(tmpdir(), ".budibase")
|
||||||
|
|
|
@ -146,18 +146,18 @@ class RestIntegration implements IntegrationBase {
|
||||||
: ""
|
: ""
|
||||||
|
|
||||||
const processedFileName = `${v4()}.${fileExtension}`
|
const processedFileName = `${v4()}.${fileExtension}`
|
||||||
const key = `${context.getProdAppId()}/attachments/${processedFileName}`
|
const key = `${context.getProdAppId()}/${processedFileName}`
|
||||||
|
const bucket = objectStore.ObjectStoreBuckets.TEMP
|
||||||
|
|
||||||
await objectStore.upload({
|
await objectStore.upload({
|
||||||
bucket: objectStore.ObjectStoreBuckets.APPS,
|
bucket: bucket,
|
||||||
filename: key,
|
filename: key,
|
||||||
body: Buffer.from(responseBuffer),
|
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()
|
raw = Buffer.from(responseBuffer).toString()
|
||||||
|
|
||||||
return {
|
return {
|
||||||
data: {
|
data: {
|
||||||
size: responseBuffer.byteLength,
|
size: responseBuffer.byteLength,
|
||||||
|
|
Loading…
Reference in New Issue