@3akram/strapi-provider-upload-google-cloud-storage
v1.3.0
Published
Google Cloud Storage provider for Strapi v5 upload
Maintainers
Readme
Strapi Google Cloud Storage Provider
A Google Cloud Storage provider for Strapi v5 upload.
Installation
yarn add @3akram/strapi-provider-upload-google-cloud-storageConfiguration
Provider Configuration
./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}
},
},
},
});Required Environment Variables
GOOGLE_CLOUD_BUCKET=your-bucket-name
GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account.jsonGoogle Cloud Setup
- 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 CreatorStorage Object ViewerStorage Object Admin(if you want to enable file deletion)
- Download the service account key JSON file and set its path in
GOOGLE_APPLICATION_CREDENTIALS
Features
- Upload files to Google Cloud Storage
- Delete files from Google Cloud Storage
- Support for uniform bucket-level access
- Detailed logging for debugging
- TypeScript support
Development
# Install dependencies
yarn install
# Build the provider
yarn build
# Run tests (when implemented)
yarn testLicense
MIT
