aboutsummaryrefslogtreecommitdiffstats
path: root/src/slskd/Core
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2024-05-17 18:27:32 -0500
committerJP Dillingham <jp@dillingham.me>2024-05-17 18:27:32 -0500
commitd221780782481d931daa11b04e14229accceee6d (patch)
tree4792389e63bb3ccb35f3724e2f2dff1ccb26caf7 /src/slskd/Core
parentad43047f4f57a26d0ab5225f22b2a78ab491a12c (diff)
downloadslskd-d221780782481d931daa11b04e14229accceee6d.tar.gz
move config under Global
Diffstat (limited to 'src/slskd/Core')
-rw-r--r--src/slskd/Core/Options.cs82
1 files changed, 41 insertions, 41 deletions
diff --git a/src/slskd/Core/Options.cs b/src/slskd/Core/Options.cs
index 37b333ba..e67be138 100644
--- a/src/slskd/Core/Options.cs
+++ b/src/slskd/Core/Options.cs
@@ -210,12 +210,6 @@ 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]
@@ -609,41 +603,6 @@ namespace slskd
}
/// <summary>
- /// File options.
- /// </summary>
- public class FilesOptions : IValidatableObject
- {
- /// <summary>
- /// Gets the permissions to apply to newly created files.
- /// </summary>
- /// <remarks>
- /// Applicable to non-Windows operating systems, only.
- /// </remarks>
- [Argument(default, "file-permissions")]
- [EnvironmentVariable("FILE_PERMISSIONS")]
- [Description("the permissions to apply to newly created files (chmod syntax, non-Windows only)")]
- public string Permissions { get; init; } = "644";
-
- /// <summary>
- /// Extended validation.
- /// </summary>
- /// <param name="validationContext"></param>
- /// <returns></returns>
- public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
- {
- var regEx = new Regex("^[0-7]{3,4}$", RegexOptions.Compiled);
- var results = new List<ValidationResult>();
-
- if (!regEx.IsMatch(Permissions))
- {
- results.Add(new ValidationResult($"Field {nameof(Permissions)} is invalid. Specify a three-character string consisting of only 0-7 (chmod syntax, 000-777, inclusive)"));
- }
-
- return results;
- }
- }
-
- /// <summary>
/// Directory options.
/// </summary>
public class DirectoriesOptions
@@ -894,6 +853,47 @@ namespace slskd
[Description("the total download speed limit")]
[Range(1, int.MaxValue)]
public int SpeedLimit { get; init; } = int.MaxValue;
+
+ /// <summary>
+ /// Gets downloaded file options.
+ /// </summary>
+ [Validate]
+ public GlobalDownloadFileOptions File { get; init; } = new GlobalDownloadFileOptions();
+ }
+
+ /// <summary>
+ /// File options.
+ /// </summary>
+ public class GlobalDownloadFileOptions : IValidatableObject
+ {
+ /// <summary>
+ /// Gets the permissions to apply to newly downloaded files.
+ /// </summary>
+ /// <remarks>
+ /// Applicable to non-Windows operating systems, only.
+ /// </remarks>
+ [Argument(default, "downloaded-file-permissions")]
+ [EnvironmentVariable("DOWNLOADED_FILE_PERMISSIONS")]
+ [Description("the permissions to apply to newly downloaded files (chmod syntax, non-Windows only)")]
+ public string Permissions { get; init; } = "644";
+
+ /// <summary>
+ /// Extended validation.
+ /// </summary>
+ /// <param name="validationContext"></param>
+ /// <returns></returns>
+ public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
+ {
+ var regEx = new Regex("^[0-7]{3,4}$", RegexOptions.Compiled);
+ var results = new List<ValidationResult>();
+
+ if (!regEx.IsMatch(Permissions))
+ {
+ results.Add(new ValidationResult($"Field {nameof(Permissions)} is invalid. Specify a three- or four-character string consisting of only 0-7 (chmod syntax, [0]000-[7]777, inclusive)"));
+ }
+
+ return results;
+ }
}
}