aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJP Dillingham <jpdillingham@gmail.com>2021-01-29 15:57:55 -0600
committerJP Dillingham <jpdillingham@gmail.com>2021-01-29 15:57:55 -0600
commitdfe00147a3a08e10c92edaa06e210c4ea20ba8c6 (patch)
treec8a70614dfa14d8dc174018f743dd22230f2f32d
parent329a367b763c8b9482ffbb9b770b0da326351e48 (diff)
downloadslskd-dfe00147a3a08e10c92edaa06e210c4ea20ba8c6.tar.gz
ensure defaults
-rw-r--r--src/slskd/Configuration.cs17
1 files changed, 9 insertions, 8 deletions
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<User> Users { get; set; }
- public IEnumerable<ApiKey> ApiKeys { get; set; }
+ public IEnumerable<User> Users { get; set; } = Enumerable.Empty<User>();
+ public IEnumerable<ApiKey> ApiKeys { get; set; } = Enumerable.Empty<ApiKey>();
public class User
{