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>,
|
{} 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({
|
return cloudStorage({
|
||||||
collections: collectionsWithAdapter,
|
collections: collectionsWithAdapter,
|
||||||
})(incomingConfig)
|
})(config)
|
||||||
}
|
}
|
||||||
|
|
||||||
function azureStorageInternal({
|
function azureStorageInternal({
|
||||||
|
|||||||
@@ -66,9 +66,27 @@ export const gcsStorage: GcsStoragePlugin =
|
|||||||
{} as Record<string, CollectionOptions>,
|
{} 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({
|
return cloudStorage({
|
||||||
collections: collectionsWithAdapter,
|
collections: collectionsWithAdapter,
|
||||||
})(incomingConfig)
|
})(config)
|
||||||
}
|
}
|
||||||
|
|
||||||
function gcsStorageInternal({ acl, bucket, options }: GcsStorageOptions): Adapter {
|
function gcsStorageInternal({ acl, bucket, options }: GcsStorageOptions): Adapter {
|
||||||
|
|||||||
@@ -79,9 +79,27 @@ export const s3Storage: S3StoragePlugin =
|
|||||||
{} as Record<string, CollectionOptions>,
|
{} 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({
|
return cloudStorage({
|
||||||
collections: collectionsWithAdapter,
|
collections: collectionsWithAdapter,
|
||||||
})(incomingConfig)
|
})(config)
|
||||||
}
|
}
|
||||||
|
|
||||||
function s3StorageInternal({ acl, bucket, config = {} }: S3StorageOptions): Adapter {
|
function s3StorageInternal({ acl, bucket, config = {} }: S3StorageOptions): Adapter {
|
||||||
|
|||||||
@@ -106,9 +106,27 @@ export const vercelBlobStorage: VercelBlobStoragePlugin =
|
|||||||
{} as Record<string, CollectionOptions>,
|
{} 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({
|
return cloudStorage({
|
||||||
collections: collectionsWithAdapter,
|
collections: collectionsWithAdapter,
|
||||||
})(incomingConfig)
|
})(config)
|
||||||
}
|
}
|
||||||
|
|
||||||
function vercelBlobStorageInternal(
|
function vercelBlobStorageInternal(
|
||||||
|
|||||||
Reference in New Issue
Block a user