Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
8 changes: 0 additions & 8 deletions src/logger.ts
Original file line number Diff line number Diff line change
@@ -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]');
Expand Down
12 changes: 0 additions & 12 deletions src/test/globalSetup.ts
Original file line number Diff line number Diff line change
@@ -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' });
Comment on lines -6 to -8

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh - this seems relevant! Currently my .env.test is pointing at a different database than my .env. Is that still necessary? In #611 we switched to a fork of postgres-migrations which fixes the schema issue, and it looks like that PR starts making use of the new functionality. Is it safe to point the tests at the same database as my local dev instance?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jasonaowen yes indeed you can use the local dev instance!


// 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 === '') &&
Expand Down