From 5c23f0a598fd64d25b181ebe68f0a6c46c095c97 Mon Sep 17 00:00:00 2001 From: Jason Claxton <30830544+Jozzey@users.noreply.github.com> Date: Tue, 8 Nov 2022 10:46:58 +0000 Subject: [PATCH] Move location where 'dotenv' is being required (#21) In a previous commit https://github.com/DEFRA/water-abstraction-system/pull/10 the 'dotenv' package was moved as early as possible in the application. Unfortunately this has turned out to be a bit too early and is causing some issues when running the unit tests locally. The unit tests don't use the /index.js so 'dotenv' is never required. The 'dotenv' require therefore needs to be moved up a level to /app/server.js. --- app/server.js | 2 ++ index.js | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/server.js b/app/server.js index 0880a62ee4..1ed2a55d23 100644 --- a/app/server.js +++ b/app/server.js @@ -1,5 +1,7 @@ 'use strict' +require('dotenv').config() + const Hapi = require('@hapi/hapi') const ServerConfig = require('../config/server.config.js') diff --git a/index.js b/index.js index 1ee8782aa5..426f3e547f 100644 --- a/index.js +++ b/index.js @@ -1,7 +1,5 @@ 'use strict' -require('dotenv').config() - const { start } = require('./app/server') start()