Browse Source

feat(single): Add Agileconfig reference

pull/1150/head
colin 1 year ago
parent
commit
b6bbd42460
  1. 1
      aspnet-core/services/LY.MicroService.Applications.Single/LY.MicroService.Applications.Single.csproj
  2. 10
      aspnet-core/services/LY.MicroService.Applications.Single/Program.cs

1
aspnet-core/services/LY.MicroService.Applications.Single/LY.MicroService.Applications.Single.csproj

@ -10,6 +10,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AgileConfig.Client" />
<PackageReference Include="DistributedLock.Redis" />
<PackageReference Include="DotNetCore.CAP.Dashboard" />
<PackageReference Include="DotNetCore.CAP.MySql" />

10
aspnet-core/services/LY.MicroService.Applications.Single/Program.cs

@ -2,6 +2,7 @@ using LINGYUN.Abp.Identity.Session.AspNetCore;
using LY.MicroService.Applications.Single;
using Microsoft.AspNetCore.Cors;
using Serilog;
using TencentCloud.Tsf.V20180326.Models;
using Volo.Abp.IO;
using Volo.Abp.Modularity.PlugIns;
@ -27,6 +28,15 @@ builder.Services.AddCors(options =>
});
builder.Host.AddAppSettingsSecretsJson()
.UseAutofac()
.ConfigureAppConfiguration((context, config) =>
{
var configuration = config.Build();
var agileConfigEnabled = configuration["AgileConfig:IsEnabled"];
if (agileConfigEnabled.IsNullOrEmpty() || bool.Parse(agileConfigEnabled))
{
config.AddAgileConfig(new AgileConfig.Client.ConfigClient(configuration));
}
})
.UseSerilog((context, provider, config) =>
{
config.ReadFrom.Configuration(context.Configuration);

Loading…
Cancel
Save