diff options
author | vnugent <public@vaughnnugent.com> | 2024-03-06 21:30:58 -0500 |
---|---|---|
committer | vnugent <public@vaughnnugent.com> | 2024-03-06 21:30:58 -0500 |
commit | 4d8cfc10382105b0acbd94df93ad3d05ff91db54 (patch) | |
tree | d9795c60b2e2a4871eddff43311866784c1c054b /plugins/VNLib.Data.Caching.Providers.VNCache/src/VnCacheClientConfig.cs | |
parent | 016a96a80cce025a86c6cf26707738f6a2eb2658 (diff) |
refactor: #2 Centralize server state, default discovery endpoints & more
Diffstat (limited to 'plugins/VNLib.Data.Caching.Providers.VNCache/src/VnCacheClientConfig.cs')
-rw-r--r-- | plugins/VNLib.Data.Caching.Providers.VNCache/src/VnCacheClientConfig.cs | 12 |
1 files changed, 10 insertions, 2 deletions
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 /// </summary> public class VnCacheClientConfig : VNCacheConfig { + const string DefaultWellKnownEndpoint = "/.well-known/vncache"; + /// <summary> /// The broker server address /// </summary> @@ -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(); } ///<inheritdoc/> |