fix: added local k8s config file, changed client to integrate with the gateway and added cors support#6
Merged
Merged
Conversation
…e gateway and added cors support
There was a problem hiding this comment.
Pull request overview
This PR updates the BoxGame deployment and client/server integration to route room assignment through the gateway, adds a local Kubernetes overrides manifest, and introduces CORS middleware to enable browser-based requests that rely on cookies.
Changes:
- Added
corssupport togatewayandserver-managerExpress apps. - Refactored the browser client to call gateway HTTP endpoints (
/createRoom,/add) to obtain the assigned game-server, then connect Socket.IO directly to that server. - Added
k8s.local.yamlfor minikube/local image overrides and adjusted parts of the basek8s.yaml.
Reviewed changes
Copilot reviewed 9 out of 11 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| server-manager/package.json | Adds cors and @types/cors dependencies. |
| server-manager/index.ts | Registers CORS middleware for server-manager API. |
| server-manager/bun.lock | Locks newly added CORS dependencies. |
| k8s.yaml | Updates gateway replica count; removes a readinessProbe block (per diff). |
| k8s.local.yaml | Adds local/minikube overrides for images and env vars. |
| gateway/routes/addToRoom.ts | Changes room lookup to query-string roomID and aligns cookie names with createRoom. |
| gateway/package.json | Adds cors and @types/cors dependencies. |
| gateway/index.ts | Registers CORS middleware on the gateway. |
| gateway/bun.lock | Locks newly added CORS dependencies. |
| client/index.js | Uses gateway HTTP endpoints + cookies to discover assigned game-server; creates sockets lazily per assignment. |
| client/index.html | Injects window.GATEWAY_URL configuration for the client runtime. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+2
to
+6
| // GATEWAY_URL is injected by index.html as a <script> block so it works | ||
| // both locally and on Vercel without a bundler. | ||
| // Locally: window.GATEWAY_URL = "http://localhost:3000" | ||
| // Vercel: window.GATEWAY_URL = "https://<your-vm-ip-or-domain>" | ||
| const GATEWAY_URL = window.GATEWAY_URL || "http://localhost:3000"; |
Comment on lines
+11
to
13
| // Use the same cookie names as createRoom so the client's getCookie() works | ||
| res.cookie("hostIp", roomMaps[roomId]["hostIp"]); | ||
| res.cookie("port", roomMaps[roomId]["port"]); |
Comment on lines
157
to
159
| spec: | ||
| replicas: 2 | ||
| replicas: 1 | ||
| selector: |
Comment on lines
+8
to
+13
| app.use( | ||
| cors({ | ||
| origin: "http://localhost:3000", | ||
| credentials: true, | ||
| }), | ||
| ); |
Comment on lines
+10
to
+14
| app.use( | ||
| cors({ | ||
| credentials: true, | ||
| }), | ||
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.