forked from koushik369mondal/WanderLust
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcloudConfig.js
More file actions
27 lines (23 loc) · 897 Bytes
/
cloudConfig.js
File metadata and controls
27 lines (23 loc) · 897 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
const cloudinary = require("cloudinary").v2;
const { CloudinaryStorage } = require("multer-storage-cloudinary");
// Check if required environment variables are set
if (!process.env.CLOUD_NAME || !process.env.CLOUD_API_KEY || !process.env.CLOUD_API_SECRET) {
console.warn("⚠️ Cloudinary environment variables are missing in cloudConfig.js.");
console.warn("ℹ️ Image uploads will not work properly without valid Cloudinary credentials.");
}
cloudinary.config({
cloud_name: process.env.CLOUD_NAME || "dummy_cloud_name",
api_key: process.env.CLOUD_API_KEY || "dummy_api_key",
api_secret: process.env.CLOUD_API_SECRET || "dummy_api_secret",
});
const storage = new CloudinaryStorage({
cloudinary: cloudinary,
params: {
folder: 'wanderlust_DEV',
allowedFormats: ['jpeg', 'png', 'jpg'],
},
});
module.exports = {
cloudinary,
storage,
}