@devon/medusa-file-bunny

0.0.7 • Public • Published

Bunny.net

Store uploaded files to your Medusa backend on bunny.net CDN.

Medusa Website | Medusa Repository

Features

  • Store product images on bunny.net

Prerequisites


How to Install

1. Run the following command in the directory of the Medusa backend:

npm install @devon/medusa-file-bunny

2. Set the following environment variables in .env:

BUNNY_STORAGE_ACCESS_KEY=<YOUR_BUNNY_STORAGE_ACCESS_KEY> # Also referred to as Storage FTP Password
BUNNY_STORAGE_ENDPOINT=<YOUR_BUNNY_STORAGE_ENDPOINT> # e.g. https://storage.bunnycdn.com
BUNNY_STORAGE_ZONE_NAME=<YOUR_BUNNY_STORAGE_ZONE_NAME>
BUNNY_STORAGE_PATH=<YOUR_BUNNY_STORAGE_PATH> # optional, will upload to top folder if not provided
BUNNY_PULL_ZONE_DOMAIN=<YOUR_BUNNY_PULL_ZONE_DOMAIN>

3. In medusa-config.js add the following at the end of the plugins array:

const plugins = [
  // ...
  {
    resolve: `@devon/medusa-file-bunny`,
    options: {
      storageAccessKey: process.env.BUNNY_STORAGE_ACCESS_KEY,
      storageEndpoint: process.env.BUNNY_STORAGE_ENDPOINT,
      storageZoneName: process.env.BUNNY_STORAGE_ZONE_NAME,
      storagePath: process.env.BUNNY_STORAGE_PATH,
      pullZoneDomain: process.env.BUNNY_PULL_ZONE_DOMAIN,
    },
  },
]

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.

Package Sidebar

Install

npm i @devon/medusa-file-bunny

Weekly Downloads

21

Version

0.0.7

License

MIT

Unpacked Size

16.4 kB

Total Files

3

Last publish

Collaborators

  • devon