Built by

Medusa

Category

Other

Version

0.0.5

Last updated

May 17, 2023, 06:21:37 AMa year ago

DigitalOcean Spaces

Store uploaded files to your Medusa backend on Spaces.

Features

  • Store product images on DigitalOcean Spaces
  • Support for importing and exporting data through CSV files, such as Products or Prices.

Prerequisites


How to Install

1. Run the following command in the directory of the Medusa backend:
npm install medusa-file-spaces
2. Set the following environment variables in
Copy to clipboard
.env
:
SPACE_URL=<YOUR_SPACE_URL>
SPACE_BUCKET=<YOUR_SPACE_NAME>
SPACE_ENDPOINT=<YOUR_SPACE_ENDPOINT>
SPACE_ACCESS_KEY_ID=<YOUR_ACCESS_KEY_ID>
SPACE_SECRET_ACCESS_KEY=<YOUR_SECRET_ACCESS_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-file-spaces`,
options: {
spaces_url: process.env.SPACE_URL,
bucket: process.env.SPACE_BUCKET,
endpoint: process.env.SPACE_ENDPOINT,
access_key_id: process.env.SPACE_ACCESS_KEY_ID,
secret_access_key: process.env.SPACE_SECRET_ACCESS_KEY,
},
},
]

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.

Additional Resources

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.