Non-Official Google Cloud Storage Provider for Strapi Upload
Install the package from your app root directory
cd /path/to/strapi/
npm install strapi-provider-upload-google-cloud-storage --save
- In the GCP Console, go to the Create service account key page..
- From the Service account list, select New service account.
- In the Service account name field, enter a name.
- From the Role list, select Storage > Administrator.
- Click Create. A JSON file that contains your key downloads to your computer.
- Copy the full content of the downloaded JSON file
- Paste it into the "Service Account JSON" field in Strapi Upload Settings
- Set an existing multi-regional Bucket name
- Define a multi-regional location (Europe [eu], Asia [asia] or United States of America [us])
- Save the configuration
- Enjoy !
If you prefer, you can set up the configuration into config/custom.json
file like this :
{
"customConfig": "This configuration is accessible through strapi.config.environments.development.myCustomConfiguration",
"gcs": {
"serviceAccount": "${process.env.GCS_SERVICE_ACCOUNT || GCS Service Account JSON}",
"bucketName": "${process.env.GCS_BUCKET_NAME || GCS Bucket Name}",
"bucketLocation": "${process.env.GCS_BUCKET_LOCATION || GCS Bucket Location}",
"baseUrl": "${process.env.GCS_BASE_URL || GCS Base URL}"
}
}
You can rename the environment variables
as you like.
- us
- eu
- asia
- https://storage.googleapis.com/{bucket-name}
- https://{bucket-name}
- http://{bucket-name}
If the bucket doesn't exist, the plugin will try to create it for you. So be carefull when you select the multi-regional option, because your bucket will be located inside.