diff options
| author | JP Dillingham <jpdillingham@gmail.com> | 2021-01-23 00:39:50 -0600 |
|---|---|---|
| committer | JP Dillingham <jpdillingham@gmail.com> | 2021-01-23 00:39:50 -0600 |
| commit | ff3b1fe36885442a6e40cac23ec8b186ef416e77 (patch) | |
| tree | 5e15c163d6179fd1f6d5129b97c458fda588c1e1 /src/slskd/Common/Options/RuntimeOptions.cs | |
| parent | fc9a1aacfb9c4e005fd482ba37394840865e9e61 (diff) | |
| download | slskd-ff3b1fe36885442a6e40cac23ec8b186ef416e77.tar.gz | |
broken wip
Diffstat (limited to 'src/slskd/Common/Options/RuntimeOptions.cs')
| -rw-r--r-- | src/slskd/Common/Options/RuntimeOptions.cs | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/src/slskd/Common/Options/RuntimeOptions.cs b/src/slskd/Common/Options/RuntimeOptions.cs index d0c28e75..cded2334 100644 --- a/src/slskd/Common/Options/RuntimeOptions.cs +++ b/src/slskd/Common/Options/RuntimeOptions.cs @@ -1,9 +1,106 @@ namespace slskd { + using System; using System.Collections.Generic; public class RuntimeOptions { + public static IEnumerable<EnvironmentVariable> EnvironmentVariableMap => new[] + { + new EnvironmentVariable { + Description = "run in debug mode", + Name = "SLSK_DEBUG", + Key = "slskd:debug" + }, + new EnvironmentVariable { + Description = "optional; a unique name for this instance", + Name = "SLSK_INSTANCE_NAME", + Key = "slskd:instancename" + }, + new EnvironmentVariable { + Description = "enable collection and publish of prometheus metrics", + Name = "SLSK_PROMETHEUS", + Key = "slskd:feature:prometheus" + }, + new EnvironmentVariable { + Description = "enable swagger documentation", + Name = "SLSK_SWAGGER", + Key = "slskd:feature:swagger" + }, + new EnvironmentVariable { + Description = "jwt signing key", + Name = "SLSKD_JWT_KEY", + Key = "slskd:web:jwt:key" + } + }; + + public static IEnumerable<Argument> ArgumentMap => new[] + { + new Argument + { + Description = "print usage", + ShortName = 'h', + LongName = "help", + Key = "slskd:showhelp" + }, + new Argument { + Description = "display version information", + ShortName = 'v', + LongName = "version", + Key = "slskd:showversion" + }, + new Argument { + Description = "run in debug mode", + ShortName = 'd', + LongName = "debug", + Key = "slskd:debug" + }, + new Argument + { + Description = "", + ShortName = 'i', + LongName = "instance-name", + Key = "slskd:instancename" + } + }; + + public class slskd + { + public bool ShowHelp { get; private set; } = false; + public bool ShowVersion { get; private set; } = false; + public bool Debug { get; private set; } = false; + public bool NoLogo { get; private set; } = false; + public bool NoAuth { get; private set; } = false; + public string InstanceName { get; private set; } = "default"; + public FeatureOptions Feature { get; private set; } = new FeatureOptions(); + public LoggerOptions Logger { get; private set; } = new LoggerOptions(); + public WebOptions Web { get; private set; } = new WebOptions(); + + public class FeatureOptions + { + public bool Prometheus { get; private set; } = false; + public bool Swagger { get; private set; } = false; + } + + public class LoggerOptions + { + public string Loki { get; private set; } = null; + } + + public class WebOptions + { + public string UrlBase { get; private set; } = "/"; + public string ContentPath { get; private set; } = "wwwroot"; + public JwtOptions Jwt { get; private set; } = new JwtOptions(); + + public class JwtOptions + { + public int TTL { get; private set; } = 1234567890; + public string Key { get; private set; } = Guid.NewGuid().ToString(); + } + } + } + public class Soulseek { public string Username { get; set; } = InstanceOptions.Username; |
