diff options
| author | JP Dillingham <jpdillingham@gmail.com> | 2024-05-09 22:30:17 -0500 |
|---|---|---|
| committer | JP Dillingham <jpdillingham@gmail.com> | 2024-05-09 22:30:17 -0500 |
| commit | 6f652112800cc3de11c1ce0eaca3162b2179d02b (patch) | |
| tree | de2554957cca0a163dd7068d5b478d929c13fb6e /src | |
| parent | a30d5fb6d9fb3ce582f62b58af0d36dccb906869 (diff) | |
| download | slskd-6f652112800cc3de11c1ce0eaca3162b2179d02b.tar.gz | |
docs, remove umask
Diffstat (limited to 'src')
| -rw-r--r-- | src/slskd/Core/Options.cs | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/src/slskd/Core/Options.cs b/src/slskd/Core/Options.cs index 3fef8a94..81e73403 100644 --- a/src/slskd/Core/Options.cs +++ b/src/slskd/Core/Options.cs @@ -613,22 +613,30 @@ namespace slskd /// </summary> public class FilesOptions : IValidatableObject { - public string Permissions { get; init; } - public string Umask { get; init; } + /// <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}", 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)) + if (!regEx.IsMatch(Permissions)) { - results.Add(new ValidationResult($"Field {nameof(Umask)} is invalid. Specify a three-character string consisting of only 0-7 (000-777, inclusive)")); + 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; |
