4.2.0 • Published 7 months ago

@lyl-radio/strapi-provider-upload-do v4.2.0

Weekly downloads
-
License
SEE LICENSE IN LI...
Repository
github
Last release
7 months ago

@lyl-radio/strapi-provider-upload-do

Resources

Links

Installation

using yarn

yarn add @lyl-radio/strapi-provider-upload-do

using npm

npm install @lyl-radio/strapi-provider-upload-do --save

Configuration

See the documentation about using a provider for information on installing and using a provider. To understand how environment variables are used in Strapi, please refer to the documentation about environment variables.

Provider Configuration

./config/plugins.js

module.exports = ({ env }) => ({
  // ...
  upload: {
    config: {
      provider: '@lyl-radio/strapi-provider-upload-do',
      providerOptions: {
        key: env('DO_SPACE_ACCESS_KEY'),
        secret: env('DO_SPACE_SECRET_KEY'),
        endpoint: env('DO_SPACE_ENDPOINT'),
        space: env('DO_SPACE_BUCKET'),
        directory: env('DO_SPACE_DIRECTORY'),
        cdn: env('DO_SPACE_CDN'),
      },
      actionOptions: {
        upload: {},
        uploadStream: {},
        delete: {},
      },
    },
  },
  // ...
});

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.

./config/middlewares.js

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

You can also add your custom CDN subdomain to img-src and media-src directives.

4.1.0

11 months ago

4.2.0

7 months ago

4.0.0

2 years ago

3.5.4

3 years ago