Skip to content

Commit

Permalink
Merge pull request #18 from microsoft/add-config-load-for-apps
Browse files Browse the repository at this point in the history
Add load of appsettings.json for payload apps
  • Loading branch information
bradarm committed Aug 2, 2024
2 parents 49c2dfb + 1d56d0e commit 12dac7c
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 12dac7c

Please sign in to comment.