This package provides a simple way to use Google Cloud Storage with Payload.
NOTE: This package removes the need to use @payloadcms/plugin-cloud-storage
as was needed in Payload 2.x.
pnpm add @payloadcms/storage-gcs
- Configure the
collections
object to specify which collections should use the Vercel Blob adapter. The slug must match one of your existing collection slugs. - When enabled, this package will automatically set
disableLocalStorage
totrue
for each collection.
import { gcsStorage } from '@payloadcms/storage-gcs'
import { Media } from './collections/Media'
import { MediaWithPrefix } from './collections/MediaWithPrefix'
export default buildConfig({
collections: [Media, MediaWithPrefix],
plugins: [
gcsStorage({
collections: {
[mediaSlug]: true,
[mediaWithPrefixSlug]: {
prefix,
},
},
bucket: process.env.GCS_BUCKET,
options: {
apiEndpoint: process.env.GCS_ENDPOINT,
projectId: process.env.GCS_PROJECT_ID,
},
}),
],
})
Option | Description | Default |
---|---|---|
enabled |
Whether or not to enable the plugin | true |
collections |
Collections to apply the storage to | |
bucket |
The name of the bucket to use | |
options |
Google Cloud Storage client configuration. See Docs | |
acl |
Access control list for files that are uploaded | Private |