From c042007803f3e4291a75d29ead84a2230f89b205 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Fri, 18 Nov 2022 14:18:56 -0600 Subject: add Enabled option --- src/slskd/Core/Options.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/slskd/Core/Options.cs b/src/slskd/Core/Options.cs index 3a61e376..368b5ca0 100644 --- a/src/slskd/Core/Options.cs +++ b/src/slskd/Core/Options.cs @@ -389,14 +389,23 @@ namespace slskd public class RelayOptions : IValidatableObject { /// - /// Gets the application operation mode. + /// Gets a value indicating whether the relay is enabled. + /// + [Argument('r', "relay")] + [EnvironmentVariable("RELAY")] + [Description("enable relay")] + [RequiresRestart] + public bool Enabled { get; init; } = false; + + /// + /// Gets the relay operation mode. /// [Argument('m', "relay-operation-mode")] [EnvironmentVariable("RELAY_OPERATION_MODE")] [Description("relay operation mode; controller, agent")] [RequiresRestart] [Enum(typeof(OperationMode))] - public string Mode { get; init; } = slskd.Relay.OperationMode.Controller.ToString().ToLowerInvariant(); + public string Mode { get; init; } = OperationMode.Controller.ToString().ToLowerInvariant(); /// /// Gets the controller configuration. @@ -414,7 +423,7 @@ namespace slskd var results = new List(); var modeResults = new List(); - if (mode == slskd.Relay.OperationMode.Agent && !Validator.TryValidateObject(Controller, new ValidationContext(Controller), modeResults, validateAllProperties: true)) + if (mode == OperationMode.Agent && !Validator.TryValidateObject(Controller, new ValidationContext(Controller), modeResults, validateAllProperties: true)) { results.Add(new CompositeValidationResult("Controller", modeResults)); } -- cgit v1.2.3