refactor(backend): load product identity from shared/product.json

This commit is contained in:
saravanakumardb1 2026-03-20 07:23:31 -07:00
parent b4a6c62e15
commit 30872465d3
2 changed files with 14 additions and 1 deletions

View 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;
};

View File

@ -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;