Category

Other

Version

1.4.0

Last updated

Apr 5, 2024, 07:05:29 AM2 months ago

Google Cloud Storage

Store uploaded files to your Medusa backend on Google Cloud Storage.

Features

  • Store product images on Google Cloud Storage.
  • Support for both private and public buckets.
  • Download/Delete product images on Google Cloud Storage.
  • Get URL product images on Google Cloud Storage.

Prerequisites


How to Install Plugin

1. Run the following command in the directory of the Medusa backend:
npm install medusa-plugin-file-cloud-storage
2. Set the following environment backend medusa variables in
Copy to clipboard
.env
. If you are deploying to a GCP product that supports Application Default credentials, you can leave
Copy to clipboard
CLIENT_EMAIL
and
Copy to clipboard
PRIVATE_KEY
this omitted, and authentication will work automatically.:
CLIENT_EMAIL=<CLIENT_EMAIL>
PRIVATE_KEY=<PRIVATE_KEY>
BUCKET_NAME=<PRIVATE_KEY>
3. In
Copy to clipboard
medusa-config.js
add the following at the end of the
Copy to clipboard
plugins
array:
const plugins = [
// ...
{
resolve: `medusa-plugin-file-cloud-storage`,
options: {
credentials : {
client_email: process.env.CLIENT_EMAIL,
private_key: process.env.PRIVATE_KEY
},
bucketName: process.env.BUCKET_NAME
},
},
]

Test the Plugin

1. Run the following command in the directory of the Medusa backend to run the backend:
npm run start
2. Upload an image for a product using the admin dashboard or using the Admin APIs.

Build your own plugins

Develop your own plugins with our API to speed up your processes.

Make your plugin available via npm for it to be shared in our Plugin Library with the broader Medusa community.