feat(D.2b): RuntimeOptions.RetailUi + AcDir toggles
Adds two startup-time env toggles that Phase D.2b's retail-UI panel frame will read: - ACDREAM_RETAIL_UI=1 → opts.RetailUi (bool, default false) - ACDREAM_AC_DIR=<path> → opts.AcDir (string?, default null) Both follow the existing helper conventions (IsExactlyOne / NullIfEmpty). No call sites broke because the only construction site in RuntimeOptions.cs already uses named arguments. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
35152248f1
commit
626d06ebc1
2 changed files with 34 additions and 2 deletions
|
|
@ -39,7 +39,9 @@ public sealed record RuntimeOptions(
|
||||||
bool RetailCloseDegrades,
|
bool RetailCloseDegrades,
|
||||||
bool DumpSceneryZ,
|
bool DumpSceneryZ,
|
||||||
bool DumpLiveSpawns,
|
bool DumpLiveSpawns,
|
||||||
int? LegacyStreamRadius)
|
int? LegacyStreamRadius,
|
||||||
|
bool RetailUi,
|
||||||
|
string? AcDir)
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Build options from the process environment. Used by
|
/// Build options from the process environment. Used by
|
||||||
|
|
@ -81,7 +83,9 @@ public sealed record RuntimeOptions(
|
||||||
DumpLiveSpawns: IsExactlyOne(env("ACDREAM_DUMP_LIVE_SPAWNS")),
|
DumpLiveSpawns: IsExactlyOne(env("ACDREAM_DUMP_LIVE_SPAWNS")),
|
||||||
// Legacy override for ACDREAM_STREAM_RADIUS. Caller applies it on
|
// Legacy override for ACDREAM_STREAM_RADIUS. Caller applies it on
|
||||||
// top of the quality preset's radii. Null when unset or invalid.
|
// top of the quality preset's radii. Null when unset or invalid.
|
||||||
LegacyStreamRadius: TryParseNonNegativeInt(env("ACDREAM_STREAM_RADIUS")));
|
LegacyStreamRadius: TryParseNonNegativeInt(env("ACDREAM_STREAM_RADIUS")),
|
||||||
|
RetailUi: IsExactlyOne(env("ACDREAM_RETAIL_UI")),
|
||||||
|
AcDir: NullIfEmpty(env("ACDREAM_AC_DIR")));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>True iff live-mode credentials are present and valid for connecting.</summary>
|
/// <summary>True iff live-mode credentials are present and valid for connecting.</summary>
|
||||||
|
|
|
||||||
28
tests/AcDream.App.Tests/RuntimeOptionsRetailUiTests.cs
Normal file
28
tests/AcDream.App.Tests/RuntimeOptionsRetailUiTests.cs
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using AcDream.App;
|
||||||
|
|
||||||
|
namespace AcDream.App.Tests;
|
||||||
|
|
||||||
|
public class RuntimeOptionsRetailUiTests
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public void Parse_ReadsRetailUiAndAcDir()
|
||||||
|
{
|
||||||
|
var env = new Dictionary<string, string?>
|
||||||
|
{
|
||||||
|
["ACDREAM_RETAIL_UI"] = "1",
|
||||||
|
["ACDREAM_AC_DIR"] = @"C:\Turbine\Asheron's Call",
|
||||||
|
};
|
||||||
|
var opts = RuntimeOptions.Parse("dats", k => env.GetValueOrDefault(k));
|
||||||
|
Assert.True(opts.RetailUi);
|
||||||
|
Assert.Equal(@"C:\Turbine\Asheron's Call", opts.AcDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Parse_DefaultsRetailUiOffAndAcDirNull()
|
||||||
|
{
|
||||||
|
var opts = RuntimeOptions.Parse("dats", _ => null);
|
||||||
|
Assert.False(opts.RetailUi);
|
||||||
|
Assert.Null(opts.AcDir);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue