Bobby Glidwell b77b0644b9
add support for actionOptions for provider upload and delete functions (#9219)
* add config.options to upload and delete functions

Supports options object in providerOptions which can contain any cloudinary upload/delete options

* add actionOptions to upload object and createProvider function

used to initialize upload/delete custom options which can be passed to a provider's upload/delete function

* Update README.md

added actionOptions description with link to available cloudinary upload/delete options

* wrapFunctionForErrors for upload and delete

* make actionOptions {} by default
2021-01-28 11:24:11 +01:00

1.6 KiB

strapi-provider-upload-cloudinary

Configurations

Your configuration is passed down to the cloudinary configuration. (e.g: cloudinary.config(config)). You can see the complete list of options here

actionOptions are passed directly to the upload and delete functions respectively allowing for custom options such as folder, type, etc. You can see the complete list of upload options here and delete options here

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.

Example

./config/plugins.js

module.exports = ({ env }) => ({
  // ...
  upload: {
    provider: 'cloudinary',
    providerOptions: {
      cloud_name: env('CLOUDINARY_NAME'),
      api_key: env('CLOUDINARY_KEY'),
      api_secret: env('CLOUDINARY_SECRET'),
    },
    actionOptions: {
      upload: {},
      delete: {}
    }
  },
  // ...
});

Resources