fix: restore windows agent https port contract
This commit is contained in:
parent
bc5e980326
commit
3b4febda6b
@ -8,7 +8,7 @@ public sealed class AgentOptions
|
||||
|
||||
public string BindAddress { get; set; } = "0.0.0.0";
|
||||
|
||||
public int Port { get; set; }
|
||||
public int HttpsPort { get; set; }
|
||||
|
||||
public int WebSocketFrameFlushMilliseconds { get; set; }
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ public static class AgentOptionsServiceCollectionExtensions
|
||||
{
|
||||
options.DataRoot = effectiveOptions.DataRoot;
|
||||
options.BindAddress = effectiveOptions.BindAddress;
|
||||
options.Port = effectiveOptions.Port;
|
||||
options.HttpsPort = effectiveOptions.HttpsPort;
|
||||
options.WebSocketFrameFlushMilliseconds = effectiveOptions.WebSocketFrameFlushMilliseconds;
|
||||
options.RingBufferLineLimit = effectiveOptions.RingBufferLineLimit;
|
||||
})
|
||||
|
||||
@ -13,9 +13,9 @@ public sealed class AgentOptionsValidator : IValidateOptions<AgentOptions>
|
||||
failures.Add("Agent:DataRoot must be configured.");
|
||||
}
|
||||
|
||||
if (options.Port is < 1 or > 65535)
|
||||
if (options.HttpsPort is < 1 or > 65535)
|
||||
{
|
||||
failures.Add("Agent:Port must be between 1 and 65535.");
|
||||
failures.Add("Agent:HttpsPort must be between 1 and 65535.");
|
||||
}
|
||||
|
||||
if (options.WebSocketFrameFlushMilliseconds <= 0)
|
||||
|
||||
@ -4,7 +4,7 @@ using TermRemoteCtl.Agent.Configuration;
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
var agentOptions = builder.Services.AddAgentOptions(builder.Configuration);
|
||||
builder.WebHost.UseUrls($"http://{agentOptions.BindAddress}:{agentOptions.Port}");
|
||||
builder.WebHost.UseUrls($"http://{agentOptions.BindAddress}:{agentOptions.HttpsPort}");
|
||||
|
||||
var app = builder.Build();
|
||||
agentOptions = app.Services.GetRequiredService<IOptions<AgentOptions>>().Value;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
"Agent": {
|
||||
"DataRoot": "C:\\ProgramData\\TermRemoteCtl",
|
||||
"BindAddress": "0.0.0.0",
|
||||
"Port": 9443,
|
||||
"HttpsPort": 9443,
|
||||
"WebSocketFrameFlushMilliseconds": 33,
|
||||
"RingBufferLineLimit": 4000
|
||||
}
|
||||
|
||||
@ -14,7 +14,7 @@ public class AgentOptionsPipelineTests
|
||||
var configuration = BuildConfiguration(new Dictionary<string, string?>
|
||||
{
|
||||
["Agent:BindAddress"] = "127.0.0.1",
|
||||
["Agent:Port"] = "9443",
|
||||
["Agent:HttpsPort"] = "9443",
|
||||
["Agent:WebSocketFrameFlushMilliseconds"] = "33",
|
||||
["Agent:RingBufferLineLimit"] = "4000"
|
||||
});
|
||||
@ -33,17 +33,17 @@ public class AgentOptionsPipelineTests
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("0", "33", "Port")]
|
||||
[InlineData("0", "33", "HttpsPort")]
|
||||
[InlineData("9443", "0", "WebSocketFrameFlushMilliseconds")]
|
||||
public void ResolveOptions_Fails_When_Config_Is_Invalid(
|
||||
string port,
|
||||
string httpsPort,
|
||||
string flushMilliseconds,
|
||||
string expectedFailure)
|
||||
{
|
||||
var configuration = BuildConfiguration(new Dictionary<string, string?>
|
||||
{
|
||||
["Agent:BindAddress"] = "127.0.0.1",
|
||||
["Agent:Port"] = port,
|
||||
["Agent:HttpsPort"] = httpsPort,
|
||||
["Agent:WebSocketFrameFlushMilliseconds"] = flushMilliseconds,
|
||||
["Agent:RingBufferLineLimit"] = "4000"
|
||||
});
|
||||
|
||||
@ -11,7 +11,7 @@ public class AgentOptionsValidatorTests
|
||||
{
|
||||
DataRoot = "",
|
||||
BindAddress = "0.0.0.0",
|
||||
Port = 9443
|
||||
HttpsPort = 9443
|
||||
};
|
||||
|
||||
var validator = new AgentOptionsValidator();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user