diff options
| author | JP Dillingham <jp@dillingham.me> | 2022-11-18 14:18:56 -0600 |
|---|---|---|
| committer | JP Dillingham <jp@dillingham.me> | 2022-11-18 14:18:56 -0600 |
| commit | c042007803f3e4291a75d29ead84a2230f89b205 (patch) | |
| tree | acb6806524625af8aab8b1c577f40e68806d6262 /src | |
| parent | 43c3a052796fbd490677de931c2b6925efa0fa5e (diff) | |
| download | slskd-c042007803f3e4291a75d29ead84a2230f89b205.tar.gz | |
add Enabled option
Diffstat (limited to 'src')
| -rw-r--r-- | src/slskd/Core/Options.cs | 15 |
1 files changed, 12 insertions, 3 deletions
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 { /// <summary> - /// Gets the application operation mode. + /// Gets a value indicating whether the relay is enabled. + /// </summary> + [Argument('r', "relay")] + [EnvironmentVariable("RELAY")] + [Description("enable relay")] + [RequiresRestart] + public bool Enabled { get; init; } = false; + + /// <summary> + /// Gets the relay operation mode. /// </summary> [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(); /// <summary> /// Gets the controller configuration. @@ -414,7 +423,7 @@ namespace slskd var results = new List<ValidationResult>(); var modeResults = new List<ValidationResult>(); - 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)); } |
