Fixed issue with Web Docker image not getting proper environment variable substitution
As ReactJS does not seem to support reading environment variables from Docker runtime variables, we'll pull it instead from buildtime. Also added copying of nginx config file in the Dockerfile Modified API Dockerfile to accept WebUri for CORS, also removed duplicate setting of CORS in Program.cs
This commit is contained in:
@ -13,6 +13,7 @@ ENV ASPNETCORE_Authentication__Auth0__Domain=
|
||||
ENV ASPNETCORE_Authentication__Auth0__Identifier=
|
||||
ENV ASPNETCORE_ConnectionStrings__YABAReadOnlyDbConnectionString=
|
||||
ENV ASPNETCORE_ConnectionStrings__YABAReadWriteDbConnectionString=
|
||||
ENV ASPNETCORE_WebClient__Url=
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/sdk:6.0-alpine AS build
|
||||
WORKDIR /src
|
||||
|
||||
@ -120,13 +120,8 @@ app.MapControllers();
|
||||
app.UseMiddleware<AddCustomClaimsMiddleware>();
|
||||
app.UseMiddleware<AddCustomLoggingPropertiesMiddleware>();
|
||||
|
||||
app.UseCors(x => x
|
||||
.AllowAnyOrigin()
|
||||
.AllowAnyMethod()
|
||||
.AllowAnyHeader());
|
||||
|
||||
var webClientUrl = configuration.GetSection("WebClient").GetValue<string>("Url");
|
||||
app.UseCors(x => x.AllowAnyHeader().AllowAnyMethod().WithOrigins(webClientUrl));
|
||||
app.UseCors(x => x.WithOrigins(webClientUrl).AllowAnyMethod().AllowAnyHeader());
|
||||
app.MapHealthChecks("/Pulse");
|
||||
|
||||
app.Run();
|
||||
|
||||
@ -41,6 +41,6 @@
|
||||
"Enrich": ["FromLogContext", "WithMachineName", "WithProcessId", "WithThreadId"]
|
||||
},
|
||||
"WebClient": {
|
||||
"Url": "https://localhost:3000"
|
||||
"Url": "http://localhost:3000"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user