aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2026-01-27 19:48:25 -0600
committerJP Dillingham <jp@dillingham.me>2026-01-27 19:48:25 -0600
commit8859b9a6c82b1490349f7ffb4f6699b502384f8a (patch)
treec0a6b43f4437be266d080a5bbfab2e757a1baf5d /src
parentdab94cbdfe2b9db21a82f447c49ba2cc46800bbb (diff)
downloadslskd-8859b9a6c82b1490349f7ffb4f6699b502384f8a.tar.gz
call it an overlay
Diffstat (limited to 'src')
-rw-r--r--src/slskd/Common/Validation/Extensions.cs6
-rw-r--r--src/slskd/Core/API/Controllers/OptionsController.cs4
-rw-r--r--src/slskd/Core/OptionsOverlay.cs (renamed from src/slskd/Core/OptionsPatch.cs)25
3 files changed, 16 insertions, 19 deletions
diff --git a/src/slskd/Common/Validation/Extensions.cs b/src/slskd/Common/Validation/Extensions.cs
index 6233d53b..87d83965 100644
--- a/src/slskd/Common/Validation/Extensions.cs
+++ b/src/slskd/Common/Validation/Extensions.cs
@@ -48,15 +48,15 @@ namespace slskd.Validation
/// <summary>
/// Validates options.
/// </summary>
- /// <param name="patch">The options patch instance to validate.</param>
+ /// <param name="overlay">The options overlay instance to validate.</param>
/// <param name="result">The result of the validation, if invalid.</param>
/// <returns>A value indicating whether the instance is valid.</returns>
- public static bool TryValidate(this OptionsPatch patch, out CompositeValidationResult result)
+ public static bool TryValidate(this OptionsOverlay overlay, out CompositeValidationResult result)
{
result = null;
var results = new List<ValidationResult>();
- if (!Validator.TryValidateObject(patch, new ValidationContext(patch), results, true))
+ if (!Validator.TryValidateObject(overlay, new ValidationContext(overlay), results, true))
{
result = new CompositeValidationResult("Invalid configuration", results);
return false;
diff --git a/src/slskd/Core/API/Controllers/OptionsController.cs b/src/slskd/Core/API/Controllers/OptionsController.cs
index f14acc39..291ae561 100644
--- a/src/slskd/Core/API/Controllers/OptionsController.cs
+++ b/src/slskd/Core/API/Controllers/OptionsController.cs
@@ -79,7 +79,7 @@ namespace slskd.Core.API
[HttpPatch]
[Authorize(Policy = AuthPolicy.Any)]
[ProducesResponseType(typeof(Options), 200)]
- public IActionResult Patch([FromBody] OptionsPatch patch)
+ public IActionResult Patch([FromBody] OptionsOverlay patch)
{
if (patch is null)
{
@@ -95,7 +95,7 @@ namespace slskd.Core.API
try
{
- Application.ApplyOptionsPatchAsync(patch);
+ Program.ApplyConfigurationOverlay(patch);
}
catch (Exception ex)
{
diff --git a/src/slskd/Core/OptionsPatch.cs b/src/slskd/Core/OptionsOverlay.cs
index 6eee75e3..faea4ea7 100644
--- a/src/slskd/Core/OptionsPatch.cs
+++ b/src/slskd/Core/OptionsOverlay.cs
@@ -1,4 +1,4 @@
-// <copyright file="OptionsPatch.cs" company="slskd Team">
+// <copyright file="OptionsOverlay.cs" company="slskd Team">
// Copyright (c) slskd Team. All rights reserved.
//
// This program is free software: you can redistribute it and/or modify
@@ -21,31 +21,30 @@ namespace slskd
using slskd.Validation;
/// <summary>
- /// Run-time patch for application <see cref="Options"/>.
+ /// Volatile run-time overlay for application <see cref="Options"/>.
/// </summary>
/// <remarks>
/// <para>
- /// The values specified in this patch are applied at run-time only, are volatile (lost when the application restarts),
+ /// The values specified in this overlay are applied at run-time only, are volatile (lost when the application restarts),
/// and take precedence over all other options, regardless of which method was used to define them.
/// </para>
/// <para>
- /// Only options that can be applied while the application is running can be patched, given the nature of how
- /// a patch is applied.
+ /// Only options that can be applied while the application is running can be overlaid, given the nature of how
+ /// an overlay is applied.
/// </para>
/// <para>
/// Every property in this class must be nullable, and must have a null default value; the application
- /// selectively applies the patch using only information explicitly supplied.
+ /// selectively applies the patch overlay only information explicitly supplied.
/// </para>
/// </remarks>
- public class OptionsPatch
+ public class OptionsOverlay
{
- public static OptionsPatch Current { get; private set; } = new();
-
+ /// <summary>
+ /// Gets options for the Soulseek client.
+ /// </summary>
[Validate]
public SoulseekOptionsPatch Soulseek { get; init; } = null;
- public static void SetCurrent(OptionsPatch patch) => Current = patch;
-
/// <summary>
/// Soulseek client options.
/// </summary>
@@ -55,9 +54,7 @@ namespace slskd
/// Gets the local IP address on which to listen for incoming connections.
/// </summary>
[IPAddress]
-#pragma warning disable CS8632 // The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
- public string? ListenIpAddress { get; init; } = null;
-#pragma warning restore CS8632 // The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
+ public string ListenIpAddress { get; init; } = null;
/// <summary>
/// Gets the port on which to listen for incoming connections.