chore(storage-*): set disableLocalStorage true for enabled collections (#5970)
This commit is contained in:
@@ -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({
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user