aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2024-04-21 18:14:15 -0500
committerJP Dillingham <jp@dillingham.me>2024-04-21 18:14:15 -0500
commitfabfad8e17222514c14ca540c3b0a9911e816f29 (patch)
treec499ebe2568ed2a3380acf368f97b67ab26d674b /src
parentd92a201c953efab7229b8c6f489001ce99b0b597 (diff)
downloadslskd-fabfad8e17222514c14ca540c3b0a9911e816f29.tar.gz
add Blacklist options
Diffstat (limited to 'src')
-rw-r--r--src/slskd/Core/Options.cs33
1 files changed, 27 insertions, 6 deletions
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
@@ -235,6 +235,12 @@ namespace slskd
public GroupsOptions Groups { get; init; } = new GroupsOptions();
/// <summary>
+ /// Gets blacklist options.
+ /// </summary>
+ [Validate]
+ public BlacklistOptions Blacklist { get; init; } = new BlacklistOptions();
+
+ /// <summary>
/// Gets filter options.
/// </summary>
[Validate]
@@ -988,12 +994,6 @@ namespace slskd
public string[] Cidrs { get; init; } = Array.Empty<string>();
/// <summary>
- /// Gets the CIDR blacklist file path.
- /// </summary>
- [FileExists(FileAccess.Read)]
- public string File { get; init; }
-
- /// <summary>
/// Extended validation.
/// </summary>
/// <param name="validationContext"></param>
@@ -1106,6 +1106,27 @@ namespace slskd
public bool Swagger { get; init; } = false;
}
+ public class BlacklistOptions
+ {
+ /// <summary>
+ /// Gets a value indicating whether blacklist file support should be enabled.
+ /// </summary>
+ [Argument(default, "enable-blacklist")]
+ [EnvironmentVariable("BLACKLIST")]
+ [Description("enable blacklist file support")]
+ [RequiresRestart]
+ public bool Enabled { get; init; }
+
+ /// <summary>
+ /// Gets the path to the blacklist file.
+ /// </summary>
+ [Argument(default, "blacklist-file")]
+ [EnvironmentVariable("BLACKLIST_FILE")]
+ [Description("path to blacklist file")]
+ [FileExists(FileAccess.Read)]
+ public string File { get; init; }
+ }
+
/// <summary>
/// Filter options.
/// </summary>