From 4d8cfc10382105b0acbd94df93ad3d05ff91db54 Mon Sep 17 00:00:00 2001 From: vnugent Date: Wed, 6 Mar 2024 21:30:58 -0500 Subject: refactor: #2 Centralize server state, default discovery endpoints & more --- .../src/VnCacheClientConfig.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'plugins/VNLib.Data.Caching.Providers.VNCache/src/VnCacheClientConfig.cs') diff --git a/plugins/VNLib.Data.Caching.Providers.VNCache/src/VnCacheClientConfig.cs b/plugins/VNLib.Data.Caching.Providers.VNCache/src/VnCacheClientConfig.cs index 383c979..0d6cd34 100644 --- a/plugins/VNLib.Data.Caching.Providers.VNCache/src/VnCacheClientConfig.cs +++ b/plugins/VNLib.Data.Caching.Providers.VNCache/src/VnCacheClientConfig.cs @@ -1,5 +1,5 @@ /* -* Copyright (c) 2023 Vaughn Nugent +* Copyright (c) 2024 Vaughn Nugent * * Library: VNLib * Package: VNLib.Data.Caching.Providers.VNCache @@ -33,6 +33,8 @@ namespace VNLib.Data.Caching.Providers.VNCache /// public class VnCacheClientConfig : VNCacheConfig { + const string DefaultWellKnownEndpoint = "/.well-known/vncache"; + /// /// The broker server address /// @@ -88,7 +90,13 @@ namespace VNLib.Data.Caching.Providers.VNCache public Uri[] GetInitialNodeUris() { _ = InitialNodes ?? throw new InvalidOperationException("Initial nodes have not been set"); - return InitialNodes.Select(static x => new Uri(x, UriKind.Absolute)).ToArray(); + return InitialNodes.Select(static x => + { + //Append a default well known endpoint if the path is just a root + Uri ur = new (x, UriKind.Absolute); + return ur.LocalPath == "/" ? new Uri(ur, DefaultWellKnownEndpoint) : ur; + }) + .ToArray(); } /// -- cgit