minio-for-strapi-v4

1.0.7 • Public • Published

minio-for-strapi-v4

This MinIo provider for Strapi V4 use JavaScript Client API Reference to upload files added in Media Library to a your self hosted MinIo server.

minio-for-strapi-v4 also auto generate and upload a webp format of each image (only for jpeg and png formats) using sharp and stream-to-array packages to allow you to use it in frontend.

Installation

npm i --save minio-for-strapi-v4

Configuration

FIRST STEP : You need to activate minio-for-strapi-v4

// file: ./config/plugins.js

module.exports = () => ({
	upload: {
		config: {
			provider: 'minio-for-strapi-v4',
			providerOptions: {
				endPoint: 'YOUR_MINIO_SERVER_DOMAIN', //s3.example.com
				port: YOUR_MINIO_SERVER_PORT, //9000
				useSSL: true, //true or false
				accessKey: 'YOUR_MINIO_ACCESS_KEY',
				secretKey: 'YOUR_MINIO_SECRET_KEY',
				bucket: 'NAME_OF_YOUR_MINIO_BUCKET',
			},
		},
	},
})

SECOND STEP : To be able to see images in Strapi dashboard, modify the strapi::security module configuration

// file: ./config/plugins.js

module.exports = [
	...,
	{
		name: 'strapi::security',
		config: {
			contentSecurityPolicy: {
				useDefaults: true,
				directives: {
					'connect-src': ["'self'", 'https:'],
					'img-src': ["'self'", 'data:', 'blob:', 'https://your_minio_server_domain:9000'],
					'media-src': ["'self'", 'data:', 'blob:', 'https://your_minio_server_domain:9000'],
					upgradeInsecureRequests: null,
				},
			},
		},
	},
	...,
]

Package Sidebar

Install

npm i minio-for-strapi-v4

Weekly Downloads

253

Version

1.0.7

License

MIT

Unpacked Size

5.1 kB

Total Files

3

Last publish

Collaborators

  • pierratdev