Skip to content

Commit

Permalink
Update environment variable names
Browse files Browse the repository at this point in the history
  • Loading branch information
prasadhonrao committed Oct 25, 2024
1 parent e24196b commit 8fbc7e8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion api/middleware/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const protect = asyncHandler(async (req, res, next) => {

try {
// Verify token
const decoded = jwt.verify(token, process.env.JWT_SECRET);
const decoded = jwt.verify(token, process.env.jwt_secret);

// Find user by id and set it to req.user so that we can use it in the controller
req.user = await User.findById(decoded.id).select('-password'); // This is the id from JWT payload
Expand Down
4 changes: 2 additions & 2 deletions api/models/User.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ UserSchema.methods.getSignedJwtToken = function () {
{
id: this._id,
},
process.env.JWT_SECRET,
process.env.jwt_secret,
{
expiresIn: process.env.JWT_EXPIRE,
expiresIn: process.env.jwt_expire,
}
);
};
Expand Down
10 changes: 5 additions & 5 deletions api/utils/sendEmail.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ import loadEnvironmentConfig from '../config/env.js';
loadEnvironmentConfig();

const transporter = nodemailer.createTransport({
host: process.env.SMTP_HOST,
port: process.env.SMTP_PORT,
host: process.env.smtp_host,
port: process.env.smtp_port,
secure: false,
auth: {
user: process.env.SMTP_EMAIL,
pass: process.env.SMTP_PASSWORD,
user: process.env.smtp_email,
pass: process.env.smtp_password,
},
});

const sendEmail = async (options) => {
const message = {
from: `${process.env.FROM_NAME}<${process.env.FROM_EMAIL}>`, // sender address
from: `${process.env.from_name}<${process.env.from_email}>`, // sender address
to: options.email, // list of receivers
subject: options.subject, // Subject line
text: options.message, // plain text body
Expand Down

0 comments on commit 8fbc7e8

Please sign in to comment.