config(battle-node): require NodeServerUrl from appsettings, no fallback
Move the localhost default off BattleNodeOptions and out of Program.cs into an appsettings.json "BattleNode" section, and make AddBattleNode throw at startup if the value is missing or blank. Deployments now must set the URL explicitly, and dev keeps working via the checked-in value. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -1,13 +1,25 @@
|
||||
namespace SVSim.BattleNode.Bridge;
|
||||
|
||||
/// <summary>
|
||||
/// DI-injected options for the battle node. NodeServerUrl matches the prod
|
||||
/// do_matching wire format: <c>host:port/socket.io/</c>, no scheme prefix.
|
||||
/// BestHTTP's SocketManager parses it as the Socket.IO v2 endpoint URL.
|
||||
/// DI-injected options for the battle node.
|
||||
/// </summary>
|
||||
public sealed class BattleNodeOptions
|
||||
{
|
||||
public string NodeServerUrl { get; set; } = "localhost:5148/socket.io/";
|
||||
/// <summary>
|
||||
/// The Socket.IO v2 endpoint URL echoed back to the client on <c>/*/do_matching</c>
|
||||
/// success (matching_state 3004/3007/3011). Matches the prod do_matching wire format:
|
||||
/// <c>host[:port]/socket.io/</c> — no scheme prefix, must end with <c>/socket.io/</c>.
|
||||
/// The client's BestHTTP <c>SocketManager</c> parses this string directly; a leading
|
||||
/// <c>http://</c>/<c>https://</c> or a missing trailing slash will make the client
|
||||
/// fail to connect. Host may be an IP, hostname, or FQDN.
|
||||
/// <para>
|
||||
/// Deployment-time value — no hardcoded fallback. Must be provided via the
|
||||
/// <c>"BattleNode:NodeServerUrl"</c> key in <c>appsettings.json</c> (or an
|
||||
/// equivalently-named env var); <see cref="Hosting.BattleNodeExtensions.AddBattleNode"/>
|
||||
/// validates presence at startup and throws if empty.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public string NodeServerUrl { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// How long the first arriver's WS waits for a partner before disconnecting.
|
||||
|
||||
Reference in New Issue
Block a user