Browse Source
Change `EnvironmentName` on `PreConfigureServices` method.
pull/14842/head
maliming
4 years ago
No known key found for this signature in database
GPG Key ID: 96224957E51C89E
3 changed files with
16 additions and
10 deletions
-
framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/AbpAspNetCoreComponentsWebAssemblyModule.cs
-
framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/AbpAspNetCoreModule.cs
-
framework/src/Volo.Abp.Core/Volo/Abp/AbpApplicationBase.cs
|
|
|
@ -24,6 +24,12 @@ public class AbpAspNetCoreComponentsWebAssemblyModule : AbpModule |
|
|
|
{ |
|
|
|
public override void PreConfigureServices(ServiceConfigurationContext context) |
|
|
|
{ |
|
|
|
var abpHostEnvironment = context.Services.GetSingletonInstance<IAbpHostEnvironment>(); |
|
|
|
if (abpHostEnvironment.EnvironmentName.IsNullOrWhiteSpace()) |
|
|
|
{ |
|
|
|
abpHostEnvironment.EnvironmentName = context.Services.GetWebAssemblyHostEnvironment().Environment; |
|
|
|
} |
|
|
|
|
|
|
|
PreConfigure<AbpHttpClientBuilderOptions>(options => |
|
|
|
{ |
|
|
|
options.ProxyClientBuildActions.Add((_, builder) => |
|
|
|
@ -35,12 +41,6 @@ public class AbpAspNetCoreComponentsWebAssemblyModule : AbpModule |
|
|
|
|
|
|
|
public override void ConfigureServices(ServiceConfigurationContext context) |
|
|
|
{ |
|
|
|
var abpHostEnvironment = context.Services.GetSingletonInstance<IAbpHostEnvironment>(); |
|
|
|
if (abpHostEnvironment.EnvironmentName.IsNullOrWhiteSpace()) |
|
|
|
{ |
|
|
|
abpHostEnvironment.EnvironmentName = context.Services.GetWebAssemblyHostEnvironment().Environment; |
|
|
|
} |
|
|
|
|
|
|
|
context.Services |
|
|
|
.GetHostBuilder().Logging |
|
|
|
.AddProvider(new AbpExceptionHandlingLoggerProvider(context.Services)); |
|
|
|
|
|
|
|
@ -29,14 +29,17 @@ namespace Volo.Abp.AspNetCore; |
|
|
|
)] |
|
|
|
public class AbpAspNetCoreModule : AbpModule |
|
|
|
{ |
|
|
|
public override void ConfigureServices(ServiceConfigurationContext context) |
|
|
|
public override void PreConfigureServices(ServiceConfigurationContext context) |
|
|
|
{ |
|
|
|
var abpHostEnvironment = context.Services.GetSingletonInstance<IAbpHostEnvironment>(); |
|
|
|
if (abpHostEnvironment.EnvironmentName.IsNullOrWhiteSpace()) |
|
|
|
{ |
|
|
|
abpHostEnvironment.EnvironmentName = context.Services.GetHostingEnvironment().EnvironmentName; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public override void ConfigureServices(ServiceConfigurationContext context) |
|
|
|
{ |
|
|
|
context.Services.AddAuthorization(); |
|
|
|
|
|
|
|
Configure<AbpAuditingOptions>(options => |
|
|
|
|
|
|
|
@ -67,10 +67,13 @@ public abstract class AbpApplicationBase : IAbpApplication |
|
|
|
ConfigureServices(); |
|
|
|
} |
|
|
|
|
|
|
|
var abpHostEnvironment = services.GetSingletonInstance<IAbpHostEnvironment>(); |
|
|
|
if (abpHostEnvironment.EnvironmentName.IsNullOrWhiteSpace()) |
|
|
|
if (options.Environment.IsNullOrWhiteSpace()) |
|
|
|
{ |
|
|
|
abpHostEnvironment.EnvironmentName = Environments.Production; |
|
|
|
var abpHostEnvironment = services.GetSingletonInstance<IAbpHostEnvironment>(); |
|
|
|
if (abpHostEnvironment.EnvironmentName.IsNullOrWhiteSpace()) |
|
|
|
{ |
|
|
|
abpHostEnvironment.EnvironmentName = Environments.Production; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|