From 1e69bf43f246c1642b3341dab8e8e4f8f826517f Mon Sep 17 00:00:00 2001 From: "francesco.belacca" Date: Fri, 19 Jan 2024 16:46:27 +0100 Subject: [PATCH] fixed the most important things for a working poc: invariantculture & cors issues --- src/BlazorPong.SignalR/BlazorPong.SignalR.csproj | 1 - src/BlazorPong.SignalR/Program.cs | 12 ++++++++++++ src/docker-compose.override.yml | 2 +- src/docker-compose.yml | 4 ++++ 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/BlazorPong.SignalR/BlazorPong.SignalR.csproj b/src/BlazorPong.SignalR/BlazorPong.SignalR.csproj index 6f7f652..e2f1aad 100644 --- a/src/BlazorPong.SignalR/BlazorPong.SignalR.csproj +++ b/src/BlazorPong.SignalR/BlazorPong.SignalR.csproj @@ -4,7 +4,6 @@ net8.0 enable enable - true afca5fd7-889a-4b24-b1b5-d4870744eb51 Linux diff --git a/src/BlazorPong.SignalR/Program.cs b/src/BlazorPong.SignalR/Program.cs index 59a55c0..a5c16ff 100644 --- a/src/BlazorPong.SignalR/Program.cs +++ b/src/BlazorPong.SignalR/Program.cs @@ -8,8 +8,20 @@ builder.AddAzureSql(); builder.AddHostedServices(); builder.AddGameServices(); +builder.Services.AddCors(options => +{ + options.AddPolicy("AllowAnyOriginPolicy", + builder => + { + builder.AllowAnyOrigin() + .AllowAnyHeader() + .AllowAnyMethod(); + }); +}); + var app = builder.Build(); +app.UseCors("AllowAnyOriginPolicy"); app.MapHub("/gamehub"); app.Run(); diff --git a/src/docker-compose.override.yml b/src/docker-compose.override.yml index 1c49e5b..7dffab2 100644 --- a/src/docker-compose.override.yml +++ b/src/docker-compose.override.yml @@ -4,7 +4,7 @@ services: webapp: environment: - ASPNETCORE_ENVIRONMENT=Development - - GameHubEndpoint=http://signalr:6351/gamehub + - GameHubEndpoint=http://localhost:6351/gamehub ports: - "6350:8080" # volumes: diff --git a/src/docker-compose.yml b/src/docker-compose.yml index 9691f56..a6b0bb4 100644 --- a/src/docker-compose.yml +++ b/src/docker-compose.yml @@ -11,6 +11,10 @@ services: build: context: . dockerfile: BlazorPong.SignalR/Dockerfile + redis: + image: "redis:latest" + azuresql: + image: "mcr.microsoft.com/azure-sql-edge:latest" # blazorpong.web.server.2: # image: ${DOCKER_REGISTRY-}blazorpongwebserver