strapi-provider-upload-exo

2.0.3 • Public • Published

Strapi : Upload Provider for Exoscale

Strapi v4 Upload Provider for Exoscale Storage (S3 compatible)

fork of: https://github.com/xpera-ch/strapi-provider-upload-exoscale

Installation

npm install strapi-provider-upload-exo
# or
yarn add strapi-provider-upload-exo

Setup

Strapi Provider Settings

plugins.js

module.exports = ({ env }) => ({
  // ...
  upload: {
    config: {
      provider: "strapi-provider-upload-exo",
      providerOptions: {
        accessKeyId: env("EXOSCALE_ACCESS_KEY_ID"),
        secretAccessKey: env("EXOSCALE_ACCESS_SECRET"),
        region: env("EXOSCALE_REGION"),
        params: {
          Bucket: env("EXOSCALE_BUCKETNAME"),
        },
      },
    },
  },
  // ...
});

Security Middleware Configuration Due to the default settings in the Strapi Security Middleware you will need to modify the contentSecurityPolicy settings to properly see thumbnail previews in the Media Library. You should replace strapi::security string with the object bellow instead as explained in the middleware configuration documentation.

middlewares.js

module.exports = [
  // ...
  {
    name: "strapi::security",
    config: {
      contentSecurityPolicy: {
        useDefaults: true,
        directives: {
          "connect-src": ["'self'", "https:"],
          "img-src": [
            "'self'",
            "data:",
            "blob:",
            "yourBucketName.yourRegion.exo.io",
          ],
          "media-src": [
            "'self'",
            "data:",
            "blob:",
            "yourBucketName.yourRegion.exo.io",
          ],
          upgradeInsecureRequests: null,
        },
      },
    },
  },
  // ...
];

Exoscale Storage (Bucket) CORS Settings

Cross-origin resource sharing (CORS) defines a way for client web applications that are loaded in one domain to interact with resources in a different domain.

Set the rules

<?xml version="1.0" ?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
  <CORSRule>
    <AllowedOrigin>*</AllowedOrigin>
    <AllowedMethod>HEAD</AllowedMethod>
    <AllowedMethod>POST</AllowedMethod>
    <AllowedMethod>GET</AllowedMethod>
    <AllowedMethod>PUT</AllowedMethod>
    <AllowedMethod>DELETE</AllowedMethod>
    <ExposeHeader>Access-Control-Allow-Origin</ExposeHeader>
  </CORSRule>
</CORSConfiguration>

License

MIT

Links

Package Sidebar

Install

npm i strapi-provider-upload-exo

Homepage

strapi.io

Weekly Downloads

48

Version

2.0.3

License

MIT

Unpacked Size

8.28 kB

Total Files

7

Last publish

Collaborators

  • raylenzin