A Google Cloud Storage provider for Strapi v5 upload.
yarn add @3akram/strapi-provider-upload-google-cloud-storage
./config/plugins.ts
export default ({ env }) => ({
upload: {
config: {
provider: '@3akram/strapi-provider-upload-google-cloud-storage',
providerOptions: {
bucketName: env('GOOGLE_CLOUD_BUCKET'),
publicFiles: true,
uniform: true,
basePath: '',
baseUrl: 'https://custom-url.com' // Optional base url. Replaces https://storage.googleapis.com/{bucketName}
},
},
},
});
GOOGLE_CLOUD_BUCKET=your-bucket-name
GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account.json
- Create a Google Cloud Storage bucket
- Enable uniform bucket-level access
- Make the bucket publicly accessible by adding the following IAM policy:
- Member:
allUsers
- Role:
Storage Object Viewer
- Member:
- Create a service account with the following roles:
Storage Object Creator
Storage Object Viewer
-
Storage Object Admin
(if you want to enable file deletion)
- Download the service account key JSON file and set its path in
GOOGLE_APPLICATION_CREDENTIALS
- Upload files to Google Cloud Storage
- Delete files from Google Cloud Storage
- Support for uniform bucket-level access
- Detailed logging for debugging
- TypeScript support
# Install dependencies
yarn install
# Build the provider
yarn build
# Run tests (when implemented)
yarn test
MIT