Skip to content

Commit

Permalink
Only config CLOUDINARY_URL if defined
Browse files Browse the repository at this point in the history
  • Loading branch information
hoangvvo committed Sep 22, 2021
1 parent 4f4f28a commit 4467ba3
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions pages/api/user/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,19 @@ import nc from 'next-connect';
const upload = multer({ dest: '/tmp' });
const handler = nc(ncOpts);

/* eslint-disable camelcase */
const {
hostname: cloud_name,
username: api_key,
password: api_secret,
} = new URL(process.env.CLOUDINARY_URL);
if (process.env.CLOUDINARY_URL) {
const {
hostname: cloud_name,
username: api_key,
password: api_secret,
} = new URL(process.env.CLOUDINARY_URL);

cloudinary.config({
cloud_name,
api_key,
api_secret,
});
cloudinary.config({
cloud_name,
api_key,
api_secret,
});
}

handler.use(all);

Expand Down

1 comment on commit 4467ba3

@vercel
Copy link

@vercel vercel bot commented on 4467ba3 Sep 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.