chore(storage-*): set disableLocalStorage true for enabled collections (#5970)

This commit is contained in:
Elliot DeNolf
2024-04-23 10:46:33 -04:00
committed by GitHub
parent 6305a1d1c2
commit 5401af5812
4 changed files with 76 additions and 4 deletions

View File

@@ -66,9 +66,27 @@ export const azureStorage: AzureStoragePlugin =
{} as Record<string, CollectionOptions>,
)
// Set disableLocalStorage: true for collections specified in the plugin options
const config = {
...incomingConfig,
collections: (incomingConfig.collections || []).map((collection) => {
if (!collectionsWithAdapter[collection.slug]) {
return collection
}
return {
...collection,
upload: {
...(typeof collection.upload === 'object' ? collection.upload : {}),
disableLocalStorage: true,
},
}
}),
}
return cloudStorage({
collections: collectionsWithAdapter,
})(incomingConfig)
})(config)
}
function azureStorageInternal({

View File

@@ -66,9 +66,27 @@ export const gcsStorage: GcsStoragePlugin =
{} as Record<string, CollectionOptions>,
)
// Set disableLocalStorage: true for collections specified in the plugin options
const config = {
...incomingConfig,
collections: (incomingConfig.collections || []).map((collection) => {
if (!collectionsWithAdapter[collection.slug]) {
return collection
}
return {
...collection,
upload: {
...(typeof collection.upload === 'object' ? collection.upload : {}),
disableLocalStorage: true,
},
}
}),
}
return cloudStorage({
collections: collectionsWithAdapter,
})(incomingConfig)
})(config)
}
function gcsStorageInternal({ acl, bucket, options }: GcsStorageOptions): Adapter {

View File

@@ -79,9 +79,27 @@ export const s3Storage: S3StoragePlugin =
{} as Record<string, CollectionOptions>,
)
// Set disableLocalStorage: true for collections specified in the plugin options
const config = {
...incomingConfig,
collections: (incomingConfig.collections || []).map((collection) => {
if (!collectionsWithAdapter[collection.slug]) {
return collection
}
return {
...collection,
upload: {
...(typeof collection.upload === 'object' ? collection.upload : {}),
disableLocalStorage: true,
},
}
}),
}
return cloudStorage({
collections: collectionsWithAdapter,
})(incomingConfig)
})(config)
}
function s3StorageInternal({ acl, bucket, config = {} }: S3StorageOptions): Adapter {

View File

@@ -106,9 +106,27 @@ export const vercelBlobStorage: VercelBlobStoragePlugin =
{} as Record<string, CollectionOptions>,
)
// Set disableLocalStorage: true for collections specified in the plugin options
const config = {
...incomingConfig,
collections: (incomingConfig.collections || []).map((collection) => {
if (!collectionsWithAdapter[collection.slug]) {
return collection
}
return {
...collection,
upload: {
...(typeof collection.upload === 'object' ? collection.upload : {}),
disableLocalStorage: true,
},
}
}),
}
return cloudStorage({
collections: collectionsWithAdapter,
})(incomingConfig)
})(config)
}
function vercelBlobStorageInternal(