aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJP Dillingham <jpdillingham@gmail.com>2024-05-08 22:44:52 -0500
committerJP Dillingham <jpdillingham@gmail.com>2024-05-08 22:44:52 -0500
commit25245ca526b436b00b2150c02e0eb946df548e93 (patch)
treef1ec173f8d615989ccfdee15328fa4ccdb83dc12 /src
parent0da8e151297fd2ea123e0e59b7928171b2006d9e (diff)
downloadslskd-25245ca526b436b00b2150c02e0eb946df548e93.tar.gz
stub options
Diffstat (limited to 'src')
-rw-r--r--src/slskd/Core/Options.cs33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/slskd/Core/Options.cs b/src/slskd/Core/Options.cs
index 81dc09f6..3fef8a94 100644
--- a/src/slskd/Core/Options.cs
+++ b/src/slskd/Core/Options.cs
@@ -210,6 +210,12 @@ namespace slskd
public RelayOptions Relay { get; init; } = new RelayOptions();
/// <summary>
+ /// Gets file options.
+ /// </summary>
+ [Validate]
+ public FilesOptions Files { get; init; } = new FilesOptions();
+
+ /// <summary>
/// Gets directory options.
/// </summary>
[Validate]
@@ -603,6 +609,33 @@ namespace slskd
}
/// <summary>
+ /// File options.
+ /// </summary>
+ public class FilesOptions : IValidatableObject
+ {
+ public string Permissions { get; init; }
+ public string Umask { get; init; }
+
+ public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
+ {
+ var regEx = new Regex("[0-7]{3}", RegexOptions.Compiled);
+ var results = new List<ValidationResult>();
+
+ if (!string.IsNullOrEmpty(Permissions) && !regEx.IsMatch(Permissions))
+ {
+ results.Add(new ValidationResult($"Field {nameof(Permissions)} is invalid. Specify a three-character string consisting of only 0-7 (000-777, inclusive)"));
+ }
+
+ if (!string.IsNullOrEmpty(Umask) && !regEx.IsMatch(Umask))
+ {
+ results.Add(new ValidationResult($"Field {nameof(Umask)} is invalid. Specify a three-character string consisting of only 0-7 (000-777, inclusive)"));
+ }
+
+ return results;
+ }
+ }
+
+ /// <summary>
/// Directory options.
/// </summary>
public class DirectoriesOptions