Route managed game APIs under profile prefixes

This commit is contained in:
2026-07-25 14:01:32 +00:00
parent 42f68d9827
commit 87e303734a
3 changed files with 11 additions and 0 deletions
+3
View File
@@ -84,6 +84,9 @@ export const createGameApiServer = async () => {
const app = fastify({
logger: true,
routerOptions: {
maxParamLength: 2048,
},
});
await app.register(cors, {
@@ -293,6 +293,9 @@ export const buildProcessDefinitions = (
PROFILE: profile.profile,
SCENARIO: profile.scenario,
GAME_API_PORT: String(profile.apiPort),
GAME_TRPC_PATH: `/${profile.profile}/api/trpc`,
GAME_API_EVENTS_PATH: `/${profile.profile}/api/events`,
GAME_UPLOAD_PATH: `/${profile.profile}/api/uploads`,
GATEWAY_REDIS_PREFIX: config.redisKeyPrefix,
GAME_TOKEN_SECRET: config.gameTokenSecret,
};
@@ -83,6 +83,11 @@ describe('buildProcessDefinitions', () => {
expect(definitions.api.cwd).toBe(path.join(buildWorkspace, 'app', 'game-api'));
expect(definitions.api.script).toBe(path.join(buildWorkspace, 'app', 'game-api', 'dist', 'index.js'));
expect(definitions.api.env).toMatchObject({
GAME_TRPC_PATH: '/che/api/trpc',
GAME_API_EVENTS_PATH: '/che/api/events',
GAME_UPLOAD_PATH: '/che/api/uploads',
});
expect(definitions.daemon.cwd).toBe(path.join(buildWorkspace, 'app', 'game-engine'));
expect(definitions.daemon.script).toBe(path.join(buildWorkspace, 'app', 'game-engine', 'dist', 'index.js'));
});