2.0.3 • Published 1 year ago

strapi-provider-upload-exo v2.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

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

2.0.3

1 year ago

2.0.2

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago