Strapi beta version set default file upload provider to AWS S3 / Google Cloud Storage (GCS) / Cloudinary

For Strapi version 3.0.0-beta.19.5 or before

Set default file upload provider as Cloudinary

Steps

yarn add strapi-provider-upload-cloudinary
// OR
npm install --save strapi-provider-upload-cloudinary
"use strict";

const isFirstRun = async () => {
const pluginStore = strapi.store({
environment: strapi.config.environment,
type: "type",
name: "setup",
});
const initHasRun = await pluginStore.get({ key: "initHasRun" });
await pluginStore.set({ key: "initHasRun", value: true });
return !initHasRun;
};

const setDefaultFileUploader = async () => {
if (strapi.config.environment !== "production") {
return;
}
const pluginStore = strapi.store({
environment: strapi.config.environment,
type: "plugin",
name: "upload",
});
const config = await pluginStore.get({ key: "provider" });
await pluginStore.set({
key: "provider",
value: {
...config,
...{
provider: "cloudinary",
name: "Cloudinary",
cloud_name: process.env.CLOUDINARY_CLOUD_NAME,
api_key: process.env.CLOUDINARY_API_KEY,
api_secret: process.env.CLOUDINARY_API_SECRET,
},
},
});
};

module.exports = async () => {
const shouldInit = await isFirstRun();
if (shouldInit) {
await setDefaultFileUploader();
}
};
cloud_name: process.env.CLOUDINARY_CLOUD_NAME,
api_key: process.env.CLOUDINARY_API_KEY,
api_secret: process.env.CLOUDINARY_API_SECRET,
heroku config:set CLOUDINARY_CLOUD_NAME=YOUR_CLOUD_NAME
heroku config:set CLOUDINARY_API_KEY=YOUR_API_KEY
heroku config:set CLOUDINARY_API_SECRET=YOUR_API_SECRET

Full stack developer