shorwood / strapi-provider-upload-do

Strapi Upload Provider for Digital Ocean Spaces. This provider will upload to the space using the AWS S3 API.
MIT License
59 stars 32 forks source link

Is it compatible with strapi 4? #24

Closed gustawdaniel closed 3 months ago

gustawdaniel commented 3 months ago

discussion https://forum.strapi.io/t/strapi-provider-upload-do-for-strapi-v4/13270/4

I checked and it works with plugins.ts

export default ({env}) => ({
  upload: {
    config: {
      provider: "strapi-provider-upload-do",
      providerOptions: {
        key: env('SPACE_ACCESS_KEY'),
        secret: env('SPACE_SECRET_KEY'),
        endpoint: env('SPACE_ENDPOINT'),
        space: env('SPACE_BUCKET'),
        directory: env('SPACE_DIRECTORY'),
        cdn: env('SPACE_BASE_URL'),
      }
    }
  }
});
gustawdaniel commented 3 months ago

but it requires extended middlewares.ts

In my case preciselab is name of bucket, and fra1 is region.

export default [
  'strapi::logger',
  'strapi::errors',
  // 'strapi::security',
  {
    name: 'strapi::security',
    config: {
      contentSecurityPolicy: {
        useDefaults: true,
          directives: {
        'connect-src': ["'self'", 'https:'],
        'img-src': ["'self'", 'data:', 'blob:',
          'preciselab.fra1.digitaloceanspaces.com',
        ],
        'media-src': ["'self'", 'data:', 'blob:',
          'preciselab.fra1.digitaloceanspaces.com',
        ],
          upgradeInsecureRequests: null
        }
      }
    }
  },
  'strapi::cors',
  'strapi::poweredBy',
  'strapi::query',
  'strapi::body',
  'strapi::session',
  'strapi::favicon',
  'strapi::public',
];