From 82d8a3b17d27acd28f1398672f83e18d442c80d4 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Tue, 21 Mar 2023 14:01:26 -0500 Subject: tweak validation --- src/slskd/Core/Options.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src') diff --git a/src/slskd/Core/Options.cs b/src/slskd/Core/Options.cs index c9b46239..1d9f814c 100644 --- a/src/slskd/Core/Options.cs +++ b/src/slskd/Core/Options.cs @@ -438,6 +438,14 @@ namespace slskd } else { + // determine whether any InstanceName is used more than once + var instanceNames = Agents.Values.Select(a => a.InstanceName); + + if (instanceNames.Count() != instanceNames.Distinct().Count()) + { + modeResults.Add(new ValidationResult("One or more Agent instance names are duplicated. Ensure instance names are unique.")); + } + foreach (var (name, agent) in Agents) { var res = new List(); @@ -515,6 +523,15 @@ namespace slskd /// public class RelayAgentConfigurationOptions : IValidatableObject { + /// + /// Gets the agent instance name. + /// + [Description("the name for this agent")] + [StringLength(255, MinimumLength = 1)] + [NotNullOrWhiteSpace] + [Secret] + public string InstanceName { get; init; } + /// /// Gets the agent secret. /// -- cgit v1.2.3