From 063200bcb17645807bcdd8dfcccf6e8866060724 Mon Sep 17 00:00:00 2001 From: roschaefer Date: Fri, 5 Jun 2020 16:29:13 +0200 Subject: [PATCH] backend: Ignore if .env file cannot be found fix: #7 --- backend/src/config/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/backend/src/config/index.js b/backend/src/config/index.js index 4c81bb181..29d9f46e5 100644 --- a/backend/src/config/index.js +++ b/backend/src/config/index.js @@ -1,7 +1,12 @@ import dotenv from 'dotenv' if (require.resolve) { // are we in a nodejs environment? - dotenv.config({ path: require.resolve('../../.env') }) + try { + dotenv.config({ path: require.resolve('../../.env') }) + } catch (error) { + if (error.code !== 'MODULE_NOT_FOUND') throw error + console.log('WARN: No `.env` file found in /backend') // eslint-disable-line no-console + } } // eslint-disable-next-line no-undef