Skip to content

Commit

Permalink
Merge pull request #960 from dongfo/master
Browse files Browse the repository at this point in the history
add  config of Gateway from yarp.json.
  • Loading branch information
colinin authored Jun 5, 2024
2 parents f73837a + ee037a8 commit 051804a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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
);
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public static async Task<int> Main(string[] args)
var builder = WebApplication.CreateBuilder(args);
builder.Host.AddAppSettingsSecretsJson()
.UseAutofac()
.AddYarpJson()
.ConfigureAppConfiguration((context, config) =>
{
var configuration = config.Build();
Expand Down

0 comments on commit 051804a

Please sign in to comment.