diff --git a/src/hooks.server.ts b/src/hooks.server.ts index 4c99ccb..17372c1 100644 --- a/src/hooks.server.ts +++ b/src/hooks.server.ts @@ -1,9 +1,7 @@ -import { log, timedExecution } from '$lib'; +import { log, timedExecution, requestIdHeader } from '$lib'; import { validate, v7 as uuidv7 } from 'uuid'; import type { Handle } from '@sveltejs/kit'; -const requestIdHeader = 'x-request-id'; - export const handle: Handle = async ({ event, resolve }) => { // use incoming requestId, if it is a valid uuid, else generate one const reqIdFromRequest = event.request.headers.get(requestIdHeader); diff --git a/src/lib/index.ts b/src/lib/index.ts index 7cee25d..c2c405a 100644 --- a/src/lib/index.ts +++ b/src/lib/index.ts @@ -29,6 +29,8 @@ if (!('STORAGE_PATH' in process.env)) { } export const storagePath: string = process.env.STORAGE_PATH ?? defaultPath; +export const requestIdHeader = 'x-request-id'; + export default safePath; export async function timedExecution(