aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2023-03-21 14:01:26 -0500
committerJP Dillingham <jp@dillingham.me>2023-03-21 14:01:26 -0500
commit82d8a3b17d27acd28f1398672f83e18d442c80d4 (patch)
tree6c9a904b517c81088366cb60f2d7216e5f7a511a /src
parent199d24e28b860b3a042d2a569cdfebd066e41be0 (diff)
downloadslskd-82d8a3b17d27acd28f1398672f83e18d442c80d4.tar.gz
tweak validation
Diffstat (limited to 'src')
-rw-r--r--src/slskd/Core/Options.cs17
1 files changed, 17 insertions, 0 deletions
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<ValidationResult>();
@@ -516,6 +524,15 @@ namespace slskd
public class RelayAgentConfigurationOptions : IValidatableObject
{
/// <summary>
+ /// Gets the agent instance name.
+ /// </summary>
+ [Description("the name for this agent")]
+ [StringLength(255, MinimumLength = 1)]
+ [NotNullOrWhiteSpace]
+ [Secret]
+ public string InstanceName { get; init; }
+
+ /// <summary>
/// Gets the agent secret.
/// </summary>
[Description("shared secret for this agent")]