From fabfad8e17222514c14ca540c3b0a9911e816f29 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 21 Apr 2024 18:14:15 -0500 Subject: add Blacklist options --- src/slskd/Core/Options.cs | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/slskd/Core/Options.cs b/src/slskd/Core/Options.cs index c38cf85e..e99eb85f 100644 --- a/src/slskd/Core/Options.cs +++ b/src/slskd/Core/Options.cs @@ -234,6 +234,12 @@ namespace slskd [Validate] public GroupsOptions Groups { get; init; } = new GroupsOptions(); + /// + /// Gets blacklist options. + /// + [Validate] + public BlacklistOptions Blacklist { get; init; } = new BlacklistOptions(); + /// /// Gets filter options. /// @@ -987,12 +993,6 @@ namespace slskd /// public string[] Cidrs { get; init; } = Array.Empty(); - /// - /// Gets the CIDR blacklist file path. - /// - [FileExists(FileAccess.Read)] - public string File { get; init; } - /// /// Extended validation. /// @@ -1106,6 +1106,27 @@ namespace slskd public bool Swagger { get; init; } = false; } + public class BlacklistOptions + { + /// + /// Gets a value indicating whether blacklist file support should be enabled. + /// + [Argument(default, "enable-blacklist")] + [EnvironmentVariable("BLACKLIST")] + [Description("enable blacklist file support")] + [RequiresRestart] + public bool Enabled { get; init; } + + /// + /// Gets the path to the blacklist file. + /// + [Argument(default, "blacklist-file")] + [EnvironmentVariable("BLACKLIST_FILE")] + [Description("path to blacklist file")] + [FileExists(FileAccess.Read)] + public string File { get; init; } + } + /// /// Filter options. /// -- cgit v1.2.3