Skip to content

Commit

Permalink
adjusting order of appsettings load
Browse files Browse the repository at this point in the history
  • Loading branch information
bigtallcampbell committed Aug 2, 2024
1 parent 91304c0 commit 7288e70
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,14 @@ public Client() {
if (_grpcHost != null || _client != null) return;

var builder = WebApplication.CreateBuilder();
// Load the configuration being supplicated by the cluster first
builder.Configuration.AddJsonFile(Path.Combine(Environment.GetEnvironmentVariable("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);

if(! string.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("SPACEFX_CONFIG_DIR")) && Directory.Exists(Environment.GetEnvironmentVariable("SPACEFX_CONFIG_DIR"))) {
builder.Configuration.AddJsonFile(Path.Combine(Environment.GetEnvironmentVariable("SPACEFX_CONFIG_DIR"), "config", "appsettings.json"), optional: true, reloadOnChange: false);
}



builder.WebHost.ConfigureKestrel(options => options.ListenAnyIP(50051, o => o.Protocols = HttpProtocols.Http2))
.ConfigureServices((services) => {
Expand Down

0 comments on commit 7288e70

Please sign in to comment.