This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

strapi-provider-upload-cloudflare-2

0.1.4 • Public • Published

strapi-provider-upload-cloudflare-2

npm version npm downloads

Non-Official Cloudflare Images and Video Upload Provider for Strapi

This has only been tested with Strapi 4.

To find your Cloudflare accountId and apiKey, log into Cloudflare and click "Images". On that page you should see "Account ID" under Developer Resources. For apiKey, if you click the "Use API" tab you'll see a link next to "API Token" to generate an apiKey. The only permissions that API Token needs are "Account.Cloudflare Images" and "Account.Cloudflare Streams".

You must specify which variant you choose using the config option variant, this will then find the variant with the set name. See below for an example in the example config.

Installation

# using yarn
yarn add strapi-provider-upload-cloudflare-2

# using npm
npm install strapi-provider-upload-cloudflare-2

Configurations

Your configuration is passed down to the provider.

See the using a provider documentation for information on installing and using a provider. And see the environment variables for setting and using environment variables in your configs.

Provider Configuration

./config/plugins.js

module.exports = ({ env }) => ({
  // ...
  upload: {
    config: {
      provider: 'strapi-provider-upload-cloudflare-2',
      providerOptions: {
        accountId: env('STRAPI_UPLOAD_CLOUDFLARE_ACCOUNT_ID'),
        apiKey: env('STRAPI_UPLOAD_CLOUDFLARE_API_KEY'),
        variant: 'cms',
      },
    },
  },
  // ...
});

To get your accountId and apiKey see the top of this README.

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:', 'imagedelivery.net'],
          'media-src': ["'self'", 'data:', 'blob:', 'imagedelivery.net'],
          upgradeInsecureRequests: null,
        },
      },
    },
  },
  // ...
];

Resources

Links

Package Sidebar

Install

npm i strapi-provider-upload-cloudflare-2

Weekly Downloads

51

Version

0.1.4

License

MIT

Unpacked Size

41.3 kB

Total Files

16

Last publish

Collaborators

  • mettle