aboutsummaryrefslogtreecommitdiffstats
path: root/src/slskd/Core/Options.cs
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2023-03-21 17:26:05 -0500
committerGitHub <noreply@github.com>2023-03-21 17:26:05 -0500
commit664b01cfc85d7c71ad40049bd2f2066916de456c (patch)
tree063f9f4d5e2b13899aac7faccc03d5fea5c0b479 /src/slskd/Core/Options.cs
parentbd4c10a559e9347be1313c544c4a590e41edca19 (diff)
parent388e567bdf78eb7aade2db7187e1e806d172d932 (diff)
downloadslskd-664b01cfc85d7c71ad40049bd2f2066916de456c.tar.gz
Merge pull request #892 from slskd/underscores
Use `instance_name` from Relay Agent config instead of map key
Diffstat (limited to 'src/slskd/Core/Options.cs')
-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")]