use app.Environment.Isdevelopment to judge current env
This commit is contained in:
@@ -21,11 +21,13 @@ using Microsoft.Extensions.Diagnostics.HealthChecks;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
var detectEnvBuilder = WebApplication.CreateBuilder(args);
|
||||
|
||||
builder.Logging.AddConsole();
|
||||
|
||||
var env = builder.Configuration["Environment"];
|
||||
var detectEnvApp = detectEnvBuilder.Build();
|
||||
|
||||
if (env == "Local"){
|
||||
if (detectEnvApp.Environment.IsDevelopment() || detectEnvApp.Environment.EnvironmentName == "Docker"){
|
||||
// Configure SQL Server (local)
|
||||
Microsoft.eShopWeb.Infrastructure.Dependencies.ConfigureServices(builder.Configuration, builder.Services);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
"IdentityConnection": "Server=(localdb)\\mssqllocaldb;Integrated Security=true;Initial Catalog=Microsoft.eShopOnWeb.Identity;"
|
||||
},
|
||||
"CatalogBaseUrl": "",
|
||||
"Environment": "Local",
|
||||
"Logging": {
|
||||
"IncludeScopes": false,
|
||||
"LogLevel": {
|
||||
|
||||
Reference in New Issue
Block a user