From dfe00147a3a08e10c92edaa06e210c4ea20ba8c6 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Fri, 29 Jan 2021 15:57:55 -0600 Subject: ensure defaults --- src/slskd/Configuration.cs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/slskd/Configuration.cs b/src/slskd/Configuration.cs index e02670df..2fe81dfb 100644 --- a/src/slskd/Configuration.cs +++ b/src/slskd/Configuration.cs @@ -2,7 +2,8 @@ { using System; using System.Collections.Generic; - + using System.Linq; + public record Option(char ShortName, string LongName, string EnvironmentVariable, Type Type, string Key, string Description = null); public static class Configuration @@ -190,9 +191,9 @@ { public string Username { get; set; } public string Password { get; set; } - public int ListenPort { get; set; } = 50000; - public DistributedNetworkOptions DistributedNetwork { get; set; } - public ConnectionOptions Connection { get; set; } + public int? ListenPort { get; set; } = 50000; + public DistributedNetworkOptions DistributedNetwork { get; set; } = new DistributedNetworkOptions(); + public ConnectionOptions Connection { get; set; } = new ConnectionOptions(); public class DistributedNetworkOptions { @@ -202,8 +203,8 @@ public class ConnectionOptions { - public TimeoutOptions Timeout { get; set; } - public BufferOptions Buffer { get; set; } + public TimeoutOptions Timeout { get; set; } = new TimeoutOptions(); + public BufferOptions Buffer { get; set; } = new BufferOptions(); public class TimeoutOptions { @@ -222,8 +223,8 @@ public class Authentication { - public IEnumerable Users { get; set; } - public IEnumerable ApiKeys { get; set; } + public IEnumerable Users { get; set; } = Enumerable.Empty(); + public IEnumerable ApiKeys { get; set; } = Enumerable.Empty(); public class User { -- cgit v1.2.3