platform-codebase/tools/platform-knowledge/shared/config.ts
2026-02-27 17:36:20 -08:00

31 lines
1 KiB
TypeScript

/**
* Platform Knowledge — shared service configuration.
*
* Central source of truth for knowledge-verification service endpoints and ports.
* Consumers should import from here rather than hardcoding values.
*/
/** Knowledge verification API port (Fastify service in knowledge-platform) */
export const KV_API_PORT = 41233;
/** Crystal infrastructure ports (managed by crystal-ai/docker-compose.yml) */
export const CRYSTAL_REDIS_PORT = 26384;
export const CRYSTAL_POSTGRES_PORT = 25470;
/** Default service URLs for development */
export const KV_API_URL = `http://localhost:${KV_API_PORT}`;
export const CRYSTAL_REDIS_URL = `redis://:kv_dev_password@localhost:${CRYSTAL_REDIS_PORT}`;
/**
* Build a knowledge-verification API URL for a given path.
*
* @example
* ```ts
* const url = kvApiUrl('/api/truth/validate');
* // => 'http://localhost:41233/api/truth/validate'
* ```
*/
export function kvApiUrl(path: string): string {
const base = process.env.TRUTH_SERVICE_URL ?? KV_API_URL;
return `${base}${path}`;
}