diff --git a/src/Client.cs b/src/Client.cs index de72107..e6787cd 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -120,13 +120,16 @@ public static Task DirectToApp(string appId, IMessage message) { public Client() { if (_grpcHost != null || _client != null) return; - - Environment.SetEnvironmentVariable("DOTNET_HOSTBUILDER__RELOADCONFIGONCHANGE", "false"); - Environment.SetEnvironmentVariable("DOTNET_USE_POLLING_FILE_WATCHER", "true"); - Environment.SetEnvironmentVariable("DOTNET_SYSTEM_GLOBALIZATION_INVARIANT", "1"); var builder = WebApplication.CreateBuilder(); + // Load the configuration being supplicated by the cluster first + builder.Configuration.AddJsonFile(Path.Combine("{env:SPACEFX_CONFIG_DIR}", "config", "appsettings.json"), optional: true, reloadOnChange: false); + + // Load any local appsettings incase they're overriding the cluster values builder.Configuration.AddJsonFile(Path.Combine(Directory.GetCurrentDirectory(), "appsettings.json"), optional: true, reloadOnChange: false); + // Load any local appsettings incase they're overriding the cluster values + builder.Configuration.AddJsonFile(Path.Combine(Directory.GetCurrentDirectory(), "appsettings.{env:DOTNET_ENVIRONMENT}.json"), optional: true, reloadOnChange: false); + builder.WebHost.ConfigureKestrel(options => options.ListenAnyIP(50051, o => o.Protocols = HttpProtocols.Http2)) .ConfigureServices((services) => { services.AddAzureOrbitalFramework();