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;