From 17c7830655099ffdda1bf043c1e4c43127322c3d Mon Sep 17 00:00:00 2001 From: Galip Tolga Erdem Date: Tue, 15 Feb 2022 15:12:30 +0300 Subject: [PATCH] added gateway host builder extensions --- .../GatewayHostBuilderExtensions.cs | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 shared/EShopOnAbp.Shared.Hosting.Gateways/GatewayHostBuilderExtensions.cs diff --git a/shared/EShopOnAbp.Shared.Hosting.Gateways/GatewayHostBuilderExtensions.cs b/shared/EShopOnAbp.Shared.Hosting.Gateways/GatewayHostBuilderExtensions.cs new file mode 100644 index 00000000..b53c608f --- /dev/null +++ b/shared/EShopOnAbp.Shared.Hosting.Gateways/GatewayHostBuilderExtensions.cs @@ -0,0 +1,24 @@ +using Microsoft.Extensions.Configuration; + +namespace Microsoft.Extensions.Hosting; + +public static class AbpHostingHostBuilderExtensions +{ + public const string AppOcelotJsonPath = "ocelot.json"; + + public static IHostBuilder AddOcelotJson( + this IHostBuilder hostBuilder, + bool optional = true, + bool reloadOnChange = true, + string path = AppOcelotJsonPath) + { + return hostBuilder.ConfigureAppConfiguration((_, builder) => + { + builder.AddJsonFile( + path: AppOcelotJsonPath, + optional: optional, + reloadOnChange: reloadOnChange + ); + }); + } +} \ No newline at end of file