0.1.0 • Published 5 months ago

@charlesshook/strapi-upload-provider-minio v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

strapi-upload-provider-minio

Resources

Installation

npm install @charlesshook/strapi-upload-provider-minio --save

Configuration

  • provider defines the name of the provider.
  • providerOptions is passed down to the constructor of the provider.
  • providerOptions.params is passed directly to the parameters of each method.
    • bucket is the name of the bucket to upload to.

Provider Configuration

./config/plugins.js

module.exports = ({ env }) => ({
  upload: {
    config: {
      provider: "@charlesshook/strapi-provider-upload-minio",
      providerOptions: {
        endPoint: env("MINIO_ENDPOINT"),
        port: env("MINIO_PORT"),
        useSSL: false,
        accessKey: env("MINIO_ACCESS_KEY"),
        secretKey: env("MINIO_SECRET_KEY"),
        params: {
          bucket: env("MINIO_BUCKET"),
        },
      },
      actionOptions: {
        upload: {},
        uploadStream: {},
        delete: {},
      },
    },
  },
});

Security Middleware Configuration

./config/middlewares.js

module.exports = [
  // ...
  {
    name: "strapi::security",
    config: {
      contentSecurityPolicy: {
        useDefaults: true,
        directives: {
          "connect-src": ["'self'", "https:"],
          "img-src": [
            "'self'",
            "data:",
            "blob:",
            "market-assets.strapi.io",
            `${env("MINIO_ENDPOINT")}:${env("MINIO_PORT")}/`,
          ],
          "media-src": [
            "'self'",
            "data:",
            "blob:",
            "market-assets.strapi.io",
            `${env("MINIO_ENDPOINT")}:${env("MINIO_PORT")}/`,
          ],
          upgradeInsecureRequests: null,
        },
      },
    },
  },
  // ...
];

Development of this provider

Test locally

At the root of the project directory run:

npm link

Inside the project that you want to add this package to:

npm link @charlesshook/strapi-upload-provider-minio
0.1.0

5 months ago