diff --git a/package-lock.json b/package-lock.json index 40a2fe844..ac2ed4bac 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,7 +15,6 @@ "ajv-keywords": "^5.1.0", "cors": "^2.8.5", "csv-parse": "^5.5.3", - "dotenv": "^16.3.1", "express": "^4.18.2", "express-jwt": "^8.4.1", "graphile-worker": "^0.16.1", @@ -4560,17 +4559,6 @@ "node": ">=6.0.0" } }, - "node_modules/dotenv": { - "version": "16.3.1", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.3.1.tgz", - "integrity": "sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ==", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/motdotla/dotenv?sponsor=1" - } - }, "node_modules/eastasianwidth": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", @@ -13569,11 +13557,6 @@ "esutils": "^2.0.2" } }, - "dotenv": { - "version": "16.3.1", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.3.1.tgz", - "integrity": "sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ==" - }, "eastasianwidth": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", diff --git a/package.json b/package.json index b100da8a9..0c8912ab1 100644 --- a/package.json +++ b/package.json @@ -82,7 +82,6 @@ "ajv-keywords": "^5.1.0", "cors": "^2.8.5", "csv-parse": "^5.5.3", - "dotenv": "^16.3.1", "express": "^4.18.2", "express-jwt": "^8.4.1", "graphile-worker": "^0.16.1", diff --git a/src/logger.ts b/src/logger.ts index 0d3f5ac90..266650a90 100644 --- a/src/logger.ts +++ b/src/logger.ts @@ -1,14 +1,6 @@ -import dotenv from 'dotenv'; import pino from 'pino'; import type { Logger } from 'pino'; -// Calling dotenv.config() prior to creating a logger ensures that environment -// variable LOG_LEVEL can be loaded from .env files. See -// https://github.com/PhilanthropyDataCommons/service/issues/59#issuecomment-1197227254 -// and following. There may be a better place than including and calling dotenv -// here in the logger code. -dotenv.config(); - // To prevent replays with JWT, we can redact the signature. This invalidates the JWT. export const redactToPreventAuthReplay = (secret: string): string => secret.replace(/^(Bearer [A-Za-z0-9]*\.[A-Za-z0-9]*\.).*/, '$1[redacted]'); diff --git a/src/test/globalSetup.ts b/src/test/globalSetup.ts index c0264c28b..860524a5d 100644 --- a/src/test/globalSetup.ts +++ b/src/test/globalSetup.ts @@ -1,19 +1,7 @@ // Jest expects a single default function to be exported from this file. /* eslint-disable import/no-default-export */ -import dotenv from 'dotenv'; import type { Config } from 'jest'; -// TODO: reconsider use of '.env.test' if or when -// https://github.com/ThomWright/postgres-migrations/pull/93 gets merged/fixed. -dotenv.config({ path: '.env.test' }); - -// Production code will run dotenv.config() anyway, so make clear that it -// happens by running the same explicitly here. If '.env.test' has any variables -// set, they will override the later/inner set variables such as those in the -// '.env' file. There might be a better way to manage 'dotenv' and pino logger -// setup. -dotenv.config(); - export default (globalConfig: Config, projectConfig: Config): void => { if ( (process.env.LOG_LEVEL === undefined || process.env.LOG_LEVEL === '') &&