From 484106ca175c50a927b1bf63303968627147f120 Mon Sep 17 00:00:00 2001 From: Lucas Morgan Date: Sat, 24 Aug 2024 23:52:30 -0500 Subject: [PATCH] Fix localhost reference. --- Shogi.UI/Shared/GameHubNode.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Shogi.UI/Shared/GameHubNode.cs b/Shogi.UI/Shared/GameHubNode.cs index 4f640c7..8970b35 100644 --- a/Shogi.UI/Shared/GameHubNode.cs +++ b/Shogi.UI/Shared/GameHubNode.cs @@ -1,6 +1,5 @@ using Microsoft.AspNetCore.SignalR.Client; using Shogi.UI.Identity; -using System.Diagnostics; namespace Shogi.UI.Shared; @@ -8,10 +7,16 @@ public class GameHubNode : IAsyncDisposable { private readonly HubConnection hubConnection; - public GameHubNode() + public GameHubNode(IConfiguration configuration) { + var baseUrl = configuration["ShogiApiUrl"]; + if (string.IsNullOrWhiteSpace(baseUrl)) + { + throw new InvalidOperationException("ShogiApiUrl configuration is missing."); + } + this.hubConnection = new HubConnectionBuilder() - .WithUrl(new Uri("https://localhost:5001/gamehub", UriKind.Absolute), options => + .WithUrl(new Uri($"{baseUrl}/gamehub", UriKind.Absolute), options => { options.HttpMessageHandlerFactory = handler => new CookieCredentialsMessageHandler { InnerHandler = handler }; options.SkipNegotiation = true;