sure, but this is not exactly what I want.
I want all my files to be uploaded into a specific directory, which means I need to populate the customConfig parameter somehow.
Looking at the code, it seems that customConfig is always empty: was it on purpose?
Anyway, being strapi open-source, I was quicky
able to create a custom provider based on the official one, configured like so:
// strapi-provider-upload-cloudinary
let upload_config = {}
module.exports = {
init(config) {
// configuration for cloudinary.config()
cloudinary.config(config.account_config);
// configuration for cloudinary.upload()
// https://cloudinary.com/documentation/image_upload_api_reference
upload_config = config.upload_config;
return {
upload(file) {
return new Promise((resolve, reject) => {
const upload_stream = cloudinary.uploader.upload_stream(
{ resource_type: 'auto', public_id: file.hash, ...upload_config }
With the following configuration:
// plugins.js
upload: {
provider: 'cloudinary',
providerOptions: {
account_config: {
cloud_name: env('CLOUDINARY_NAME'),
api_key: env('CLOUDINARY_KEY'),
api_secret: env('CLOUDINARY_SECRET'),
},
upload_config: {
folder: env('CLOUDINARY_FOLDER'),
// ... and some
}
},
}
I think this is the way it was intended. Let me know. I can send you a PR if you want to implement my solution.