diff --git a/src/Program.cs b/src/Program.cs index bd305e4..f5c495e 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -4,10 +4,14 @@ public class Program { public static void Main(string[] args) { var builder = WebApplication.CreateBuilder(args); - builder.Configuration.AddJsonFile("/workspaces/hostsvc-position-config/appsettings.json", optional: true, reloadOnChange: true) - .AddJsonFile("/workspaces/hostsvc-position/src/appsettings.json", optional: true, reloadOnChange: true) - .AddJsonFile("/workspaces/hostsvc-position/src/appsettings.{env:DOTNET_ENVIRONMENT}.json", optional: true, reloadOnChange: true) - .Build(); + // 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) => { diff --git a/test/debugClient/Program.cs b/test/debugClient/Program.cs index adf4a7f..f29b053 100644 --- a/test/debugClient/Program.cs +++ b/test/debugClient/Program.cs @@ -4,9 +4,14 @@ public class Program { public static void Main(string[] args) { var builder = WebApplication.CreateBuilder(args); - builder.Configuration - .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) - .AddJsonFile("appsettings.{env:DOTNET_ENVIRONMENT}.json", optional: true, reloadOnChange: true); + // 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) => { diff --git a/test/integrationTests/TestSharedContext.cs b/test/integrationTests/TestSharedContext.cs index fb07cf9..d4db866 100644 --- a/test/integrationTests/TestSharedContext.cs +++ b/test/integrationTests/TestSharedContext.cs @@ -24,7 +24,16 @@ public TestSharedContext() { if (_grpcHost != null) return; var builder = WebApplication.CreateBuilder(); - builder.Configuration.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true); + + // 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) => {