diff options
| author | JP Dillingham <jpdillingham@gmail.com> | 2021-06-27 12:04:48 -0500 |
|---|---|---|
| committer | JP Dillingham <jpdillingham@gmail.com> | 2021-06-27 12:04:48 -0500 |
| commit | 949d158c07bd4ef595876725a509f0f71b3a5f10 (patch) | |
| tree | 5c41562b4107e16946df0dcb6d42ae3661ebaa6f /src | |
| parent | 343712527943431dcb03e5d22293f77b8803b22a (diff) | |
| download | slskd-949d158c07bd4ef595876725a509f0f71b3a5f10.tar.gz | |
add FTP options
Diffstat (limited to 'src')
| -rw-r--r-- | src/slskd/Options.cs | 75 | ||||
| -rw-r--r-- | src/slskd/Properties/slskd.yml | 10 |
2 files changed, 84 insertions, 1 deletions
diff --git a/src/slskd/Options.cs b/src/slskd/Options.cs index 485619bc..73678df0 100644 --- a/src/slskd/Options.cs +++ b/src/slskd/Options.cs @@ -21,6 +21,7 @@ namespace slskd using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.Diagnostics; + using FluentFTP; using slskd.Validation; using Soulseek.Diagnostics; using Utility.CommandLine; @@ -122,6 +123,12 @@ namespace slskd public SoulseekOptions Soulseek { get; private set; } = new SoulseekOptions(); /// <summary> + /// Gets options for external integrations. + /// </summary> + [Validate] + public IntegrationOptions Integration { get; private set; } = new IntegrationOptions(); + + /// <summary> /// Directory options. /// </summary> public class DirectoriesOptions @@ -547,5 +554,73 @@ namespace slskd } } } + + /// <summary> + /// Options for external integrations. + /// </summary> + public class IntegrationOptions + { + /// <summary> + /// Gets FTP options. + /// </summary> + [Validate] + public FTPOptions FTP { get; private set; } = new FTPOptions(); + + /// <summary> + /// FTP options. + /// </summary> + public class FTPOptions + { + /// <summary> + /// Gets the FTP address. + /// </summary> + [Argument(default, "ftp-address")] + [EnvironmentVariable("FTP_ADDRESS")] + [Description("FTP address")] + public string Address { get; private set; } + + /// <summary> + /// Gets the FTP port. + /// </summary> + [Argument(default, "ftp-port")] + [EnvironmentVariable("FTP_PORT")] + [Description("FTP port")] + [Range(1, 65535)] + public int Port { get; private set; } = 21; + + /// <summary> + /// Gets the FTP encryption mode. + /// </summary> + [Argument(default, "ftp-encryption-mode")] + [EnvironmentVariable("FTP_ENCRYPTION_MODE")] + [Description("FTP encryption mode; none, implicit, explicit, auto")] + [Enum(typeof(FtpEncryptionMode))] + public string EncryptionMode { get; private set; } = "auto"; + + /// <summary> + /// Gets the FTP username. + /// </summary> + [Argument(default, "ftp-username")] + [EnvironmentVariable("FTP_USERNAME")] + [Description("FTP username")] + public string Username { get; private set; } + + /// <summary> + /// Gets the FTP password. + /// </summary> + [Argument(default, "ftp-password")] + [EnvironmentVariable("FTP_PASSWORD")] + [Description("FTP password")] + public string Password { get; private set; } + + /// <summary> + /// Gets the number of times failing uploads will be retried. + /// </summary> + [Argument(default, "ftp-retry-attempts")] + [EnvironmentVariable("FTP_RETRY_ATTEMPTS")] + [Description("The number of times failing uploads will be retried")] + public int RetryAttempts { get; private set; } = 5; + } + } } }
\ No newline at end of file diff --git a/src/slskd/Properties/slskd.yml b/src/slskd/Properties/slskd.yml index ccfe60f9..492fb01c 100644 --- a/src/slskd/Properties/slskd.yml +++ b/src/slskd/Properties/slskd.yml @@ -48,4 +48,12 @@ # address: ~ # port: ~ # username: ~ -# password: ~
\ No newline at end of file +# password: ~ +# integration: +# ftp: +# address: ~ +# port: ~ +# encryption_mode: auto +# username: ~ +# password: ~ +# retry_attempts: 5
\ No newline at end of file |
