Skip to content

Commit

Permalink
env fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Julia Khabibova committed Oct 30, 2023
1 parent b122ecc commit 6768ab6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion backend/controllers/users.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
const bcrypt = require('bcryptjs');
const jwt = require('jsonwebtoken');

const { SECRET_KEY = 'mesto' } = process.env;
const { HTTP_STATUS_OK, HTTP_STATUS_CREATED } = require('http2').constants;
const mongoose = require('mongoose');
const User = require('../models/user');
const BadRequestError = require('../errors/BadRequestError');
const NotFoundError = require('../errors/NotFoundError');
const ConflictError = require('../errors/ConflictError');
const { SECRET_KEY } = require('../utils/config');

module.exports.getUsers = (req, res, next) => {
User.find({})
Expand Down
2 changes: 1 addition & 1 deletion backend/middlewares/auth.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const jwt = require('jsonwebtoken');

const { SECRET_KEY = 'mesto' } = process.env;
const { SECRET_KEY } = require('../utils/config');
const UnautorizedError = require('../errors/UnauthorizedError');

// eslint-disable-next-line consistent-return
Expand Down
5 changes: 5 additions & 0 deletions backend/utils/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const SECRET_KEY = process.env.NODE_ENV === 'production' ? process.env.SECRET_KEY : 'mesto-secret-key';

module.exports = {
SECRET_KEY,
};

0 comments on commit 6768ab6

Please sign in to comment.