Merge remote-tracking branch 'origin/main' into fix/agent-systemd-credentials
# Conflicts: # install/install-agent.sh # src/Heimdall.Agent/AgentOptions.cs
This commit is contained in:
commit
7262c6dc55
8 files changed
+36
-12
No files matched your search
@@ -16,7 +16,11 @@ public sealed class AgentOptions
|
||||
[Required, Url]
|
||||
public string CentralUrl { get; init; } = string.Empty;
|
||||
|
||||
/// <summary>Allow an unencrypted HTTP Central URL for isolated development networks only.</summary>
|
||||
public bool AllowInsecureHttp { get; init; }
|
||||
|
||||
/// <summary>Site token for initial agent registration.</summary>
|
||||
[Required, MinLength(1)]
|
||||
public string SiteToken
|
||||
{
|
||||
get => string.IsNullOrWhiteSpace(_siteToken)
|
||||
|
||||
@@ -39,6 +39,10 @@ if (!string.IsNullOrEmpty(sentryDsn))
|
||||
builder.Services.AddOptions<AgentOptions>()
|
||||
.BindConfiguration(AgentOptions.SectionName)
|
||||
.ValidateDataAnnotations()
|
||||
.Validate(options => Uri.TryCreate(options.CentralUrl, UriKind.Absolute, out var centralUri) &&
|
||||
(centralUri.Scheme == Uri.UriSchemeHttps ||
|
||||
(options.AllowInsecureHttp && centralUri.Scheme == Uri.UriSchemeHttp)),
|
||||
"Agent:CentralUrl must use HTTPS unless Agent:AllowInsecureHttp is explicitly enabled.")
|
||||
.ValidateOnStart();
|
||||
|
||||
// HTTP clients
|
||||
|
||||
Reference in new issue
Block a user