From 022461e8bc1acce57b338da1ce7f74da183d143a Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sat, 14 Feb 2026 17:47:17 -0600 Subject: validate gluetun url --- src/slskd/Core/Options.cs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src') 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 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; } /// -- cgit v1.2.3