Browse Source

Merge pull request #960 from dongfo/master

add  config of Gateway from yarp.json.
pull/969/head
yx lin 2 years ago
committed by GitHub
parent
commit
051804a1d8
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 24
      gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.Gateway/AbpHostingHostBuilderExtensions.cs
  2. 1
      gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.Gateway/Program.cs

24
gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.Gateway/AbpHostingHostBuilderExtensions.cs

@ -0,0 +1,24 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
namespace LINGYUN.MicroService.Internal.Gateway;
public static class AbpHostingHostBuilderExtensions
{
public const string AppYarpJsonPath = "yarp.json";
public static IHostBuilder AddYarpJson(
this IHostBuilder hostBuilder,
bool optional = true,
bool reloadOnChange = true,
string path = AppYarpJsonPath)
{
return hostBuilder.ConfigureAppConfiguration((_, builder) =>
{
builder.AddJsonFile(
path: AppYarpJsonPath,
optional: optional,
reloadOnChange: reloadOnChange
);
});
}
}

1
gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.Gateway/Program.cs

@ -19,6 +19,7 @@ public class Program
var builder = WebApplication.CreateBuilder(args);
builder.Host.AddAppSettingsSecretsJson()
.UseAutofac()
.AddYarpJson()
.ConfigureAppConfiguration((context, config) =>
{
var configuration = config.Build();

Loading…
Cancel
Save