Skip to content

Commit

Permalink
feat(APIM-468): merge main branch
Browse files Browse the repository at this point in the history
  • Loading branch information
avaitonis committed Jul 28, 2023
2 parents 1b5cfe3 + fc54db2 commit 2ec2c5f
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 34 deletions.
1 change: 1 addition & 0 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ PORT=

LOG_LEVEL=debug
REDACT_LOGS=false
SINGLE_LINE_LOG_FORMAT=true

# Swagger
SWAGGER_USER=
Expand Down
60 changes: 30 additions & 30 deletions package-lock.json

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

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"passport": "^0.6.0",
"passport-headerapikey": "^1.2.2",
"pino-http": "^8.3.3",
"pino-pretty": "^10.1.0",
"pino-pretty": "^10.2.0",
"reflect-metadata": "^0.1.13",
"rxjs": "^7.8.1",
"tsconfig-paths": "^4.2.0",
Expand All @@ -62,8 +62,8 @@
"@types/compression": "^1.7.2",
"@types/express": "^4.17.17",
"@types/jest": "^29.5.3",
"@types/lodash": "^4.14.195",
"@types/node": "^20.4.4",
"@types/lodash": "^4.14.196",
"@types/node": "^20.4.5",
"@types/supertest": "^2.0.12",
"@typescript-eslint/eslint-plugin": "^6.2.0",
"@typescript-eslint/parser": "^6.2.0",
Expand Down
5 changes: 5 additions & 0 deletions src/config/app.config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ describe('appConfig', () => {
environmentVariableName: string;
defaultConfigValue: boolean;
}[] = [
{
configPropertyName: 'singleLineLogFormat',
environmentVariableName: 'SINGLE_LINE_LOG_FORMAT',
defaultConfigValue: true,
},
{
configPropertyName: 'redactLogs',
environmentVariableName: 'REDACT_LOGS',
Expand Down
2 changes: 2 additions & 0 deletions src/config/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export interface AppConfig {
apiKey: string;
logLevel: string;
redactLogs: boolean;
singleLineLogFormat: boolean;
}

export default registerAs('app', (): Record<string, any> => {
Expand All @@ -40,5 +41,6 @@ export default registerAs('app', (): Record<string, any> => {
apiKey: process.env.API_KEY,
logLevel: process.env.LOG_LEVEL || 'info',
redactLogs: process.env.REDACT_LOGS !== 'false',
singleLineLogFormat: process.env.SINGLE_LINE_LOG_FORMAT !== 'false',
};
});
2 changes: 1 addition & 1 deletion src/main.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { LoggingInterceptor } from './logging/logging-interceptor.helper';
transport: {
target: 'pino-pretty',
options: {
singleLine: true,
singleLine: config.get<boolean>('app.singleLineLogLevel'),
},
},
hooks: {
Expand Down
2 changes: 2 additions & 0 deletions test/support/environment-variables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export const ENVIRONMENT_VARIABLES = Object.freeze({
NODE_ENV: 'test',
LOG_LEVEL: 'debug',
REDACT_LOGS: false,
SINGLE_LINE_LOG_FORMAT: true,

SWAGGER_USER: valueGenerator.string(),
SWAGGER_PASSWORD: valueGenerator.string(),
Expand All @@ -22,6 +23,7 @@ export const ENVIRONMENT_VARIABLES = Object.freeze({
export const getEnvironmentVariablesForProcessEnv = (): NodeJS.ProcessEnv => ({
...ENVIRONMENT_VARIABLES,
REDACT_LOGS: ENVIRONMENT_VARIABLES.REDACT_LOGS.toString(),
SINGLE_LINE_LOG_FORMAT: ENVIRONMENT_VARIABLES.SINGLE_LINE_LOG_FORMAT.toString(),
APIM_INFORMATICA_MAX_REDIRECTS: ENVIRONMENT_VARIABLES.APIM_INFORMATICA_MAX_REDIRECTS.toString(),
APIM_INFORMATICA_TIMEOUT: ENVIRONMENT_VARIABLES.APIM_INFORMATICA_TIMEOUT.toString(),
});
Expand Down

0 comments on commit 2ec2c5f

Please sign in to comment.