Route managed game APIs under profile prefixes
This commit is contained in:
@@ -84,6 +84,9 @@ export const createGameApiServer = async () => {
|
|||||||
|
|
||||||
const app = fastify({
|
const app = fastify({
|
||||||
logger: true,
|
logger: true,
|
||||||
|
routerOptions: {
|
||||||
|
maxParamLength: 2048,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
await app.register(cors, {
|
await app.register(cors, {
|
||||||
|
|||||||
@@ -293,6 +293,9 @@ export const buildProcessDefinitions = (
|
|||||||
PROFILE: profile.profile,
|
PROFILE: profile.profile,
|
||||||
SCENARIO: profile.scenario,
|
SCENARIO: profile.scenario,
|
||||||
GAME_API_PORT: String(profile.apiPort),
|
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,
|
GATEWAY_REDIS_PREFIX: config.redisKeyPrefix,
|
||||||
GAME_TOKEN_SECRET: config.gameTokenSecret,
|
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.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.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.cwd).toBe(path.join(buildWorkspace, 'app', 'game-engine'));
|
||||||
expect(definitions.daemon.script).toBe(path.join(buildWorkspace, 'app', 'game-engine', 'dist', 'index.js'));
|
expect(definitions.daemon.script).toBe(path.join(buildWorkspace, 'app', 'game-engine', 'dist', 'index.js'));
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user