update aws deployment, have client get env from server

This commit is contained in:
Evan
2025-03-05 12:37:37 -08:00
parent be5157a25c
commit 2b26cfbbc9
15 changed files with 159 additions and 66 deletions
+17 -2
View File
@@ -4,14 +4,17 @@ import express from "express";
import { GameMapType, GameType, Difficulty } from "../core/game/Game";
import { generateID } from "../core/Util";
import { PseudoRandom } from "../core/PseudoRandom";
import { GameEnv, getServerConfig } from "../core/configuration/Config";
import {
GameEnv,
getServerConfigFromServer,
} from "../core/configuration/Config";
import { GameInfo } from "../core/Schemas";
import path from "path";
import rateLimit from "express-rate-limit";
import { fileURLToPath } from "url";
import { isHighTrafficTime } from "./Util";
const config = getServerConfig();
const config = getServerConfigFromServer();
const readyWorkers = new Set();
const app = express();
@@ -121,6 +124,18 @@ export async function startMaster() {
});
}
app.get("/api/env", (req, res) => {
const envConfig = {
game_env: process.env.GAME_ENV || "prod",
};
res.set("Cache-Control", "no-cache, no-store, must-revalidate");
res.set("Pragma", "no-cache");
res.set("Expires", "0");
res.json(envConfig);
});
// Add lobbies endpoint to list public games for this worker
app.get("/public_lobbies", (req, res) => {
res.send(publicLobbiesJsonStr);
+2 -2
View File
@@ -4,7 +4,7 @@ import { WebSocketServer } from "ws";
import path from "path";
import { fileURLToPath } from "url";
import { GameManager } from "./GameManager";
import { getServerConfig } from "../core/configuration/Config";
import { getServerConfigFromServer } from "../core/configuration/Config";
import { WebSocket } from "ws";
import { Client } from "./Client";
import rateLimit from "express-rate-limit";
@@ -14,7 +14,7 @@ import { slog } from "./StructuredLog";
import { GameType } from "../core/game/Game";
import { archive } from "./Archive";
const config = getServerConfig();
const config = getServerConfigFromServer();
// Worker setup
export function startWorker() {