aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2026-02-14 17:47:17 -0600
committerJP Dillingham <jp@dillingham.me>2026-02-14 17:47:17 -0600
commit022461e8bc1acce57b338da1ce7f74da183d143a (patch)
treee11aa00e3bcac2bd84e397aa2ce61d9c7e04f0d0
parentb11904bb36d0ae868b69773ac5efe44646da4116 (diff)
downloadslskd-022461e8bc1acce57b338da1ce7f74da183d143a.tar.gz
validate gluetun url
-rw-r--r--src/slskd/Core/Options.cs16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/slskd/Core/Options.cs b/src/slskd/Core/Options.cs
index cc4c367a..644fb885 100644
--- a/src/slskd/Core/Options.cs
+++ b/src/slskd/Core/Options.cs
@@ -2345,10 +2345,19 @@ namespace slskd
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{
- // as/if more VPN clients are added, update this logic to ensure that exactly one is configured
- if (Enabled && string.IsNullOrWhiteSpace(Gluetun?.Url))
+ if (Enabled)
{
- yield return new ValidationResult("VPN is enabled but no client is configured");
+ // as/if more VPN clients are added, update this logic to ensure that exactly one is configured
+ if (string.IsNullOrWhiteSpace(Gluetun?.Url))
+ {
+ yield return new ValidationResult("VPN is enabled but no client is configured");
+ yield break;
+ }
+
+ if (!Uri.TryCreate(Gluetun.Url, UriKind.Absolute, out _))
+ {
+ yield return new ValidationResult("The gluetun URL must be absolute, e.g. 'http://127.0.0.1:8000'");
+ }
}
}
@@ -2372,7 +2381,6 @@ namespace slskd
[Argument(default, "vpn-gluetun-url")]
[EnvironmentVariable("VPN_GLUETUN_URL")]
[Description("URL for gluetun control server")]
- [NotNullOrWhiteSpace]
public string Url { get; init; }
/// <summary>