refactor(backend): load product identity from shared/product.json
This commit is contained in:
parent
b4a6c62e15
commit
30872465d3
13
backend/src/lib/product-config.ts
Normal file
13
backend/src/lib/product-config.ts
Normal file
@ -0,0 +1,13 @@
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { resolve } from 'node:path';
|
||||
|
||||
const raw = JSON.parse(
|
||||
readFileSync(resolve(process.cwd(), '../shared/product.json'), 'utf-8')
|
||||
);
|
||||
|
||||
export const PRODUCT_ID: string = raw.productId;
|
||||
export const productConfig = raw as {
|
||||
productId: string;
|
||||
displayName: string;
|
||||
[key: string]: unknown;
|
||||
};
|
||||
@ -19,7 +19,7 @@ declare module 'fastify' {
|
||||
}
|
||||
}
|
||||
|
||||
const PRODUCT_ID = 'chronomind';
|
||||
import { PRODUCT_ID } from './product-config.js';
|
||||
|
||||
export function getRequestProductId(req: FastifyRequest): string {
|
||||
const jwtPid = req.jwtPayload?.productId;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user