Skip to content

Commit

Permalink
Merge pull request #172 from BackendsByMTT/dev-a-redis
Browse files Browse the repository at this point in the history
add folder name to env
  • Loading branch information
TrippyRahul authored Sep 13, 2024
2 parents 6eff0ed + bb4c304 commit d52d6d7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/banner/bannerController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class BannerController {
(resolve, reject) => {
cloudinary.v2.uploader
.upload_stream(
{ resource_type: "image", folder: "Banner" },
{ resource_type: "image", folder: config.cloud_folder },
(error, result) => {
if (error) {
return reject(error);
Expand Down Expand Up @@ -120,7 +120,7 @@ class BannerController {
}

const imageId = bannerData.url.split("/").pop()?.split(".")[0];
const publicId = `Banner/${imageId}`;
const publicId = `${config.cloud_folder}/${imageId}`;

const cloudinaryResult = await new Promise((resolve, reject) => {
cloudinary.v2.uploader.destroy(publicId, (destroyError, result) => {
Expand Down
6 changes: 5 additions & 1 deletion src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ const _config = {
key: process.env.ODDS_API_KEY,
},
betCommission: process.env.BET_COMMISSION,
redisUrl: process.env.NODE_ENV === 'development' ? 'redis://localhost:6379' : process.env.REDIS_URL,
redisUrl:
process.env.NODE_ENV === "development"
? "redis://localhost:6379"
: process.env.REDIS_URL,
sentToMail: process.env.SENT_TO_MAIL,
awsAccessKeyId: process.env.AWS_ACCESS_KEY_ID,
awsSecretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
Expand All @@ -22,6 +25,7 @@ const _config = {
cloud_name: process.env.CLOUDINARY_NAME,
api_key: process.env.CLOUDINARY_NAME_API_KEY,
api_secret: process.env.CLOUDINARY_NAME_API_SECRET,
cloud_folder: process.env.CLOUDINARY_FOLDER_NAME,
};

export const config = Object.freeze(_config);

0 comments on commit d52d6d7

Please sign in to comment.