Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kingwill101/medusa-file-gcp
Google cloud storage plugin for medusajs
https://github.com/kingwill101/medusa-file-gcp
Last synced: about 2 months ago
JSON representation
Google cloud storage plugin for medusajs
- Host: GitHub
- URL: https://github.com/kingwill101/medusa-file-gcp
- Owner: kingwill101
- License: mit
- Created: 2022-02-12T01:12:18.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-11-12T11:03:10.000Z (about 1 year ago)
- Last Synced: 2024-11-02T20:31:51.015Z (2 months ago)
- Language: TypeScript
- Size: 561 KB
- Stars: 12
- Watchers: 2
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-medusajs - GCP - square) ![stars](https://img.shields.io/github/stars/kingwill101/medusa-file-gcp) (Uncategorized / Uncategorized)
README
# Medusa File Google Cloud Storage Images
Google Cloud Platform (GCP) storage plugin for Medusa.js
## Prerequisites
- [Medusa backend](https://docs.medusajs.com/development/backend/install/)
- [Google Cloud Platform (GCP)](https://cloud.google.com/)## How to install
1. Run the following command in the directory of your Medusa backend:
```
npm install medusa-plugin-gcp
```2. Add following environment variables into your `.env`:
```
GCP_BUCKET=
GCP_PRIVATE_KEY=
GCP_CLIENT_EMAIL=
```3. Open your `medusa.config.js` and add the below configuration:
```js
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
```2. Try to upload an image for a product using Medusa's admin interface. The image should appear into your storage bucket.
## Additional resources
- [GCP Storage Buckets](Bucketshttps://cloud.google.com/storage/docs/creating-buckets/)
- [GCP Service Accounts](https://cloud.google.com/iam/docs/service-account-overview/)
- [@google-cloud/storage (package)](https://www.npmjs.com/package/@google-cloud/storage/)