mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-05 14:12:03 +00:00
update aws deployment, have client get env from server
This commit is contained in:
+17
-2
@@ -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);
|
||||
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user