A provider for strapi server to upload file to Qiniu Cloud
A provider for strapi server to upload file to Qiniu Cloud
$ npm install provider-upload-qiniu-cloud --save
or
$ yarn add provider-upload-qiniu-cloud --save
For more details, please see: https://strapi.io/documentation/developer-docs/latest/development/plugins/upload.html#using-a-provider
The lastest version of the provider supports v4 by default. See example below for ./config/plugins.js
:
1module.exports = ({ env }) => ({
2 upload: {
3 config: {
4 provider: 'provider-upload-qiniu-cloud', // full package name is required
5 providerOptions: {
6 accessKey: env('ACCESS_KEY', ''),
7 secretKey: env('SECRET_KEY', ''),
8 prefix: env('PREFIX', ''),
9 zone: env('ZONE', 'Zone_z0'),
10 bucket: env('BUCKET', ''),
11 publicBucketDomain: env('PUBLIC_BUCKET_DOMAIN', ''),
12 https: env('HTTPS', true),
13 cdn: env('CDN', false),
14 },
15 },
16 },
17});
Official documentation here
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
1module.exports = [
2 // ...
3 {
4 name: 'strapi::security',
5 config: {
6 contentSecurityPolicy: {
7 useDefaults: true,
8 directives: {
9 'connect-src': ["'self'", 'https:'],
10 'img-src': ["'self'", 'data:', 'blob:', '*'],
11 'media-src': ["'self'", 'data:', 'blob:', '*'],
12 upgradeInsecureRequests: null,
13 },
14 },
15 },
16 },
17 // ...
18];
Property | type | value |
---|---|---|
accessKey | string | <qiniu access key id> |
secretKey | string | <qiniu access key secret> |
bucket | string | bucket name |
prefix | string | dir name in bucket |
zone | string | qiniu region (see Qiniu Development Documentation below) |
publicBucketDomain | string | custom origin domain name for accessing the uploaded file, e.g. // example: http://if-pbl.qiniudn.com |
https | boolean | Domain with or without https |
cdn | boolean | Whether to use cdn acceleration when uploading |
npm install provider-upload-qiniu-cloud
Check out the available plugin resources that will help you to develop your plugin or provider and get it listed on the marketplace.