aboutsummaryrefslogtreecommitdiffstats
path: root/src/slskd/Program.cs
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2026-10-28 19:13:25 -0500
committerGitHub <noreply@github.com>2026-10-28 19:13:25 -0500
commit2e127575c5231ea94a2f327084c5da29b8a9e895 (patch)
treec155815345acac601326890d66d0ea8faf29fce3 /src/slskd/Program.cs
parent47c0c9fccbe976c1d1f8f71c6b0bfd45bceda1a4 (diff)
parent2b827344d11e7490b323defa898264cadbdb6089 (diff)
downloadslskd-2e127575c5231ea94a2f327084c5da29b8a9e895.tar.gz
Merge branch 'master' into bugs
Diffstat (limited to 'src/slskd/Program.cs')
-rw-r--r--src/slskd/Program.cs14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/slskd/Program.cs b/src/slskd/Program.cs
index 1865453f..879f76b7 100644
--- a/src/slskd/Program.cs
+++ b/src/slskd/Program.cs
@@ -454,7 +454,17 @@ namespace slskd
if (OptionsAtStartup.Debug)
{
- Log.Information($"Configuration:\n{Configuration.GetDebugView()}");
+ // redact values for any key matching the name of a property marked [Secret]. keys from YAML may be
+ // snake or kebab case, so normalize before comparing. this over-redacts, which is fine here
+ var secretNames = typeof(Options).Assembly.GetTypes()
+ .Where(t => t == typeof(Options) || (t.FullName?.StartsWith($"{typeof(Options).FullName}+") ?? false))
+ .SelectMany(t => t.GetProperties())
+ .Where(p => p.GetCustomAttributes(typeof(SecretAttribute), inherit: false).Length > 0)
+ .Select(p => p.Name.ToLowerInvariant())
+ .ToHashSet();
+
+ Log.Information($"Configuration:\n{Configuration.GetDebugView(context =>
+ secretNames.Contains(context.Key.Replace("_", string.Empty).Replace("-", string.Empty).ToLowerInvariant()) ? "*****" : context.Value)}");
}
if (!OptionsAtStartup.TryValidate(out var result))
@@ -465,7 +475,7 @@ namespace slskd
}
catch (Exception ex)
{
- Log.Information($"Invalid configuration: {(!OptionsAtStartup.Debug ? ex : ex.Message)}");
+ Log.Information($"Invalid configuration: {(OptionsAtStartup.Debug ? ex : ex.Message)}");
return;
}