Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions packages/storage-gcs/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,29 @@ export const gcsStorage: GcsStoragePlugin =
})

if (isPluginDisabled) {
// If alwaysInsertFields is true, still call cloudStoragePlugin to insert fields
if (gcsStorageOptions.alwaysInsertFields) {
// Build collections with adapter: null since plugin is disabled
const collectionsWithoutAdapter: CloudStoragePluginOptions['collections'] = Object.entries(
gcsStorageOptions.collections,
).reduce(
(acc, [slug, collOptions]) => ({
...acc,
[slug]: {
...(collOptions === true ? {} : collOptions),
adapter: null,
},
}),
{} as Record<string, CollectionOptions>,
)

return cloudStoragePlugin({
alwaysInsertFields: true,
collections: collectionsWithoutAdapter,
enabled: false,
})(incomingConfig)
}

return incomingConfig
}

Expand Down