fix: change the order in which env vars are loaded
This commit is contained in:
parent
f39998d57b
commit
55c0eba6e4
11
app.js
11
app.js
@ -3,12 +3,19 @@ const path = require('path');
|
||||
const morgan = require('morgan');
|
||||
const helmet = require('helmet');
|
||||
const compression = require('compression');
|
||||
const app = express();
|
||||
// const movieRouter = require('./routes/movieRoutes');
|
||||
const dotenv = require('dotenv');
|
||||
|
||||
const viewRouter = require('./routes/viewRoutes');
|
||||
const globalErrorHandler = require('./controllers/errorControllers');
|
||||
const { AppError } = require('./utils/errorUtils');
|
||||
|
||||
const app = express();
|
||||
|
||||
//---------------------------------------------------------------------------//
|
||||
// LOADING CONFIG FILE VARIABLES
|
||||
//---------------------------------------------------------------------------//
|
||||
dotenv.config({ path: './config.env' }); // loading .env variables
|
||||
|
||||
//-------------------------------------------------------------------------//
|
||||
// GLOBAL MIDDLEWARES
|
||||
//-------------------------------------------------------------------------//
|
||||
|
@ -1,4 +1,3 @@
|
||||
const dotenv = require('dotenv');
|
||||
const app = require('./app');
|
||||
|
||||
//---------------------------------------------------------------------------//
|
||||
@ -16,11 +15,6 @@ process.on('unhandledRejection', err => {
|
||||
server.close(() => process.exit(1)); // shutting the system down gracefully
|
||||
});
|
||||
|
||||
//---------------------------------------------------------------------------//
|
||||
// LOADING CONFIG FILE VARIABLES
|
||||
//---------------------------------------------------------------------------//
|
||||
dotenv.config({ path: './config.env' }); // loading .env variables
|
||||
|
||||
//---------------------------------------------------------------------------//
|
||||
// STARTING SERVER
|
||||
//---------------------------------------------------------------------------//
|
||||
|
Loading…
x
Reference in New Issue
Block a user