8000 feat: customizable request header name · sasajib/postgres-meta@715306c · GitHub
[go: up one dir, main page]

Skip to content

Commit 715306c

Browse files
committed
feat: customizable request header name
1 parent b73ace8 commit 715306c

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/server/app.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import fastify from 'fastify'
2-
import { PG_META_EXPORT_DOCS, PG_META_PORT } from './constants'
2+
import { PG_META_EXPORT_DOCS, PG_META_PORT, PG_META_REQ_HEADER } from './constants'
33
import routes from './routes'
44
import { extractRequestForLogging } from './utils'
55
import pino from 'pino'
@@ -17,6 +17,7 @@ const logger = pino({
1717
const app = fastify({
1818
logger,
1919
disableRequestLogging: true,
20+
requestIdHeader: PG_META_REQ_HEADER,
2021
})
2122

2223
app.setErrorHandler((error, request, reply) => {

src/server/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ export const PG_CONNECTION = `postgres://${PG_META_DB_USER}:${PG_META_DB_PASSWOR
1414
export const PG_META_EXPORT_DOCS = process.env.PG_META_EXPORT_DOCS === 'true' || false
1515

1616
export const DEFAULT_POOL_CONFIG = { max: 1, connectionTimeoutMillis: PG_CONN_TIMEOUT_SECS * 1000 }
17+
export const PG_META_REQ_HEADER = process.env.PG_META_REQ_HEADER || 'request-id'

0 commit comments

Comments
 (0)
0