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 builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
|
var detectEnvBuilder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
builder.Logging.AddConsole();
|
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)
|
// Configure SQL Server (local)
|
||||||
Microsoft.eShopWeb.Infrastructure.Dependencies.ConfigureServices(builder.Configuration, builder.Services);
|
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;"
|
"IdentityConnection": "Server=(localdb)\\mssqllocaldb;Integrated Security=true;Initial Catalog=Microsoft.eShopOnWeb.Identity;"
|
||||||
},
|
},
|
||||||
"CatalogBaseUrl": "",
|
"CatalogBaseUrl": "",
|
||||||
"Environment": "Local",
|
|
||||||
"Logging": {
|
"Logging": {
|
||||||
"IncludeScopes": false,
|
"IncludeScopes": false,
|
||||||
"LogLevel": {
|
"LogLevel": {
|
||||||
|
|||||||
Reference in New Issue
Block a user