Skip to content

Commit

Permalink
Move API Url to configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
Skleni committed Apr 12, 2023
1 parent 0031530 commit 28471e7
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/TicTacToe/TicTacToe.Blazor/Pages/Index.razor
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
@using Microsoft.AspNetCore.SignalR.Client;
@using Microsoft.AspNetCore.WebUtilities
@inject NavigationManager NavigationManager
@inject IConfiguration Configuration

<style type="text/css">
.board {
Expand Down Expand Up @@ -61,9 +62,9 @@ else
protected override async Task OnInitializedAsync()
{
hubConnection = new HubConnectionBuilder()
.WithUrl("http://localhost:7255/api")
.WithUrl(Configuration["ApiUrl"]!)
.Build();

Console.WriteLine(Configuration["ApiUrl"]);
hubConnection.On<string, Player>("GameJoined", (gameId, player) =>
{
this.gameId = gameId;
Expand Down
6 changes: 3 additions & 3 deletions src/TicTacToe/TicTacToe.Blazor/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"applicationUrl": "http://localhost:5291",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
"ASPNETCORE_ENVIRONMENT": "Dev"
}
},
"https": {
Expand All @@ -25,15 +25,15 @@
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"applicationUrl": "https://localhost:7130;http://localhost:5291",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
"ASPNETCORE_ENVIRONMENT": "Dev"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
"ASPNETCORE_ENVIRONMENT": "Dev"
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/TicTacToe/TicTacToe.Blazor/wwwroot/appsettings.Dev.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"ApiUrl": "http://localhost:7255/api"
}
3 changes: 3 additions & 0 deletions src/TicTacToe/TicTacToe.Blazor/wwwroot/appsettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"ApiUrl": "/api"
}

0 comments on commit 28471e7

Please sign in to comment.