@redskytech/provider-upload-imagekit
v4.5.3
Published
Imagekit provider for strapi
Downloads
2
Readme
@redskytech/provider-upload-imagekit
Resources
Links
Installation
# using yarn
yarn add @redskytech/provider-upload-imagekit
# using npm
npm install @redskytech/provider-upload-imagekit --save
Configuration
provider
defines the name of the providerproviderOptions
is passed down during the construction of the provider. (ex:new AWS.S3(config)
). Complete list of optionsactionOptions
is passed directly to the parameters to each method respectively. You can find the complete list of upload/ uploadStream options and delete options
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: '@redskytech/provider-upload-imagekit',
providerOptions: {
access: {
publicKey : env('IMAGEKIT_PUBLIC_KEY'),
privateKey : env('IMAGEKIT_PRIVATE_KEY'),
urlEndpoint : env('IMAGEKIT_URL_ENDPOINT'),
},
params: {
pathPrefix: env('IMAGEKIT_PATH_PREFIX', ''),
}
}
}
},
// ...
});
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:',
'dl.airtable.com',
'yourImagekit.imagekit.com',
],
'media-src': [
"'self'",
'data:',
'blob:',
'dl.airtable.com',
'yourImagekit.imagekit.com',
],
upgradeInsecureRequests: null,
},
},
},
},
// ...
];