medusa-plugin-google-bucket
TypeScript icon, indicating that this package has built-in type declarations

1.0.8 • Public • Published

Medusa File Google Cloud Storage Images

Google Cloud Platform (GCP) storage plugin for Medusa.js

Prerequisites

How to install

  1. Run the following command in the directory of your Medusa backend:
yarn add medusa-plugin-google-bucket
npm install medusa-plugin-google-bucket
  1. Add following environment variables into your .env:
GCP_BUCKET=<YOUR_BUCKET_NAME>
GCP_PRIVATE_KEY=<YOUR_SERVICE_ACCOUNT_PRIVATE_KEY>
GCP_CLIENT_EMAIL=<YOUR_SERVICE_ACCOUNT_IAM_EMAIL>
  1. Open your medusa.config.js and add the below configuration:
module.exports = {
  plugins: [
    ...otherMedusaPlugins,
    {
      resolve: `medusa-plugin-gcp`,
      /** @type {import('medusa-plugin-gcp').PluginOptions} */
      options: {
        bucket: process.env.GCP_BUCKET,
        fileNaming: "original_random", // @default to original_random, options: original, random, original_random
        credentials: {
          private_key: process.env.GCP_PRIVATE_KEY,
          client_email: process.env.GCP_CLIENT_EMAIL,
        },
      },
    },
  ],
};

Test the plugin

  1. Run your Medusa backend:
npm run dev
  1. Try to upload an image for a product using Medusa's admin interface. The image should appear into your storage bucket.

Additional resources

/medusa-plugin-google-bucket/

    Package Sidebar

    Install

    npm i medusa-plugin-google-bucket

    Weekly Downloads

    17

    Version

    1.0.8

    License

    MIT

    Unpacked Size

    10 kB

    Total Files

    5

    Last publish

    Collaborators

    • lulu45