diff options
| author | JP Dillingham <jp@dillingham.me> | 2026-01-30 18:15:12 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-01-30 18:15:12 -0600 |
| commit | 09eabbce7d9bd4d42ffa9c30f97faa909a9ff8b0 (patch) | |
| tree | 19e3a3da819dcd0568a10377fe8a6eacf3998902 /src/slskd/Core/Extensions.cs | |
| parent | 92b49b7a4035822240ba51ffdf3383eb9a30b164 (diff) | |
| parent | d2bf89cc204e89c04f66b778d9f94e325deb5a3d (diff) | |
| download | slskd-09eabbce7d9bd4d42ffa9c30f97faa909a9ff8b0.tar.gz | |
Merge pull request #1623 from slskd/runtime-config
Add the ability to apply an options 'overlay' at run-time; enabling update of listen IP and port
Diffstat (limited to 'src/slskd/Core/Extensions.cs')
| -rw-r--r-- | src/slskd/Core/Extensions.cs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/slskd/Core/Extensions.cs b/src/slskd/Core/Extensions.cs index db75cc9c..0789fa38 100644 --- a/src/slskd/Core/Extensions.cs +++ b/src/slskd/Core/Extensions.cs @@ -42,6 +42,21 @@ namespace slskd } /// <summary> + /// Redacts this instance of OptionsOverlay, replacing properties marked with <see cref="SecretAttribute"/> with '*****'. + /// </summary> + /// <remarks> + /// Creates a deep clone before redacting. + /// </remarks> + /// <param name="options">The OptionsOverlay instance to redact.</param> + /// <returns>A redacted instance.</returns> + public static OptionsOverlay Redact(this OptionsOverlay options) + { + var redacted = options.ToJson().FromJson<OptionsOverlay>(); + Redactor.Redact(redacted, redactWith: "*****"); + return redacted; + } + + /// <summary> /// Creates a copy of this instance with the specified parameters changed. /// </summary> /// <param name="o">The options instance to copy.</param> |
