From 2a16835625a3d358e36a52388386eede8fa94089 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Wed, 12 May 2021 08:55:54 -0500 Subject: add app/incomplete directories to config --- src/slskd/Options.cs | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) (limited to 'src/slskd/Options.cs') diff --git a/src/slskd/Options.cs b/src/slskd/Options.cs index 527cfc42..4777cb9f 100644 --- a/src/slskd/Options.cs +++ b/src/slskd/Options.cs @@ -127,13 +127,20 @@ namespace slskd public class DirectoriesOptions { /// - /// Gets the path to shared files. + /// Gets the path where application data is saved. /// - [Argument('s', "shared")] - [EnvironmentVariable("SHARED_DIR")] - [Description("path to shared files")] - [Required] - public string Shared { get; private set; } = null; + [Argument(default, "app")] + [EnvironmentVariable("APP_DIR")] + [Description("path where application data is saved")] + public string App { get; private set; } = Program.DefaultAppDirectory; + + /// + /// Gets the path where incomplete downloads are saved. + /// + [Argument(default, "incomplete")] + [EnvironmentVariable("INCOMPLETE_DIR")] + [Description("path where incomplete downloads are saved")] + public string Incomplete { get; private set; } = Program.DefaultIncompleteDirectory; /// /// Gets the path where downloaded files are saved. @@ -141,8 +148,15 @@ namespace slskd [Argument('o', "downloads")] [EnvironmentVariable("DOWNLOADS_DIR")] [Description("path where downloaded files are saved")] - [Required] - public string Downloads { get; private set; } = null; + public string Downloads { get; private set; } = Program.DefaultDownloadsDirectory; + + /// + /// Gets the path to shared files. + /// + [Argument('s', "shared")] + [EnvironmentVariable("SHARED_DIR")] + [Description("path to shared files")] + public string Shared { get; private set; } = Program.DefaultSharedDirectory; } /// -- cgit v1.2.3 From 691dcadcd97921c244e8c33d4fececcb52dd97e3 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Fri, 14 May 2021 12:59:26 -0500 Subject: use StringLength instead of Required for options with defaults --- src/slskd/Options.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/slskd/Options.cs') diff --git a/src/slskd/Options.cs b/src/slskd/Options.cs index 4777cb9f..6074d650 100644 --- a/src/slskd/Options.cs +++ b/src/slskd/Options.cs @@ -371,7 +371,7 @@ namespace slskd [Argument(default, "content-path")] [EnvironmentVariable("CONTENT_PATH")] [Description("path to static web content")] - [Required] + [StringLength(255, MinimumLength = 1)] public string ContentPath { get; private set; } = "wwwroot"; /// @@ -399,7 +399,7 @@ namespace slskd [Argument('u', "username")] [EnvironmentVariable("USERNAME")] [Description("username for web UI")] - [Required] + [StringLength(255, MinimumLength = 1)] public string Username { get; private set; } = Program.AppName; /// @@ -408,7 +408,7 @@ namespace slskd [Argument('p', "password")] [EnvironmentVariable("PASSWORD")] [Description("password for web UI")] - [Required] + [StringLength(255, MinimumLength = 1)] public string Password { get; private set; } = Program.AppName; /// @@ -428,7 +428,7 @@ namespace slskd [Argument(default, "jwt-key")] [EnvironmentVariable("JWT_KEY")] [Description("JWT signing key")] - [Required] + [StringLength(255, MinimumLength = 1)] public string Key { get; private set; } = Guid.NewGuid().ToString(); /// -- cgit v1.2.3