From dc39646fafe317280f0d7801fe4773315e62792b Mon Sep 17 00:00:00 2001 From: Ryan Campbell Date: Fri, 2 Aug 2024 02:48:05 +0000 Subject: [PATCH 1/4] updating settings load --- src/Program.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Program.cs b/src/Program.cs index 7159499..a24be61 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -4,9 +4,14 @@ public class Program { public static void Main(string[] args) { var builder = WebApplication.CreateBuilder(args); - builder.Configuration.AddJsonFile("/workspace/platform-deployment-config/appsettings.json", optional: true, reloadOnChange: true) - .AddJsonFile("/workspace/platform-deployment/src/appsettings.json", optional: true, reloadOnChange: true) - .AddJsonFile("/workspace/platform-deployment/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) => { From d85c09d3384b9f1d0431ead700cf39443e3b91c0 Mon Sep 17 00:00:00 2001 From: Ryan Campbell Date: Fri, 2 Aug 2024 02:49:51 +0000 Subject: [PATCH 2/4] updating appsettings load --- test/debugClient/Program.cs | 11 ++++++++--- test/integrationTests/TestSharedContext.cs | 9 ++++++++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/test/debugClient/Program.cs b/test/debugClient/Program.cs index 51f4943..934d26a 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 9c390f6..92bceef 100644 --- a/test/integrationTests/TestSharedContext.cs +++ b/test/integrationTests/TestSharedContext.cs @@ -26,7 +26,14 @@ public TestSharedContext() { K8S_CLIENT = new k8s.Kubernetes(config); 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) => { From dafda99e4c4352de6ee64d6948a29b07a98172ea Mon Sep 17 00:00:00 2001 From: Ryan Campbell Date: Fri, 2 Aug 2024 02:53:49 +0000 Subject: [PATCH 3/4] updating appsettings build --- src/Program.cs | 3 +++ test/debugClient/Program.cs | 3 +++ test/integrationTests/TestSharedContext.cs | 3 +++ 3 files changed, 9 insertions(+) diff --git a/src/Program.cs b/src/Program.cs index a24be61..7984ba6 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -13,6 +13,9 @@ public static void Main(string[] args) { // 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); + // Build the configuration + build.Configuration.Build(); + builder.WebHost.ConfigureKestrel(options => options.ListenAnyIP(50051, o => o.Protocols = HttpProtocols.Http2)) .ConfigureServices((services) => { services.AddAzureOrbitalFramework(); diff --git a/test/debugClient/Program.cs b/test/debugClient/Program.cs index 934d26a..bbb526c 100644 --- a/test/debugClient/Program.cs +++ b/test/debugClient/Program.cs @@ -13,6 +13,9 @@ public static void Main(string[] args) { // 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); + // Build the configuration + build.Configuration.Build(); + builder.WebHost.ConfigureKestrel(options => options.ListenAnyIP(50051, o => o.Protocols = HttpProtocols.Http2)) .ConfigureServices((services) => { services.AddAzureOrbitalFramework(); diff --git a/test/integrationTests/TestSharedContext.cs b/test/integrationTests/TestSharedContext.cs index 92bceef..fab52ee 100644 --- a/test/integrationTests/TestSharedContext.cs +++ b/test/integrationTests/TestSharedContext.cs @@ -35,6 +35,9 @@ public TestSharedContext() { // 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); + // Build the configuration + build.Configuration.Build(); + builder.WebHost.ConfigureKestrel(options => options.ListenAnyIP(50051, o => o.Protocols = HttpProtocols.Http2)) .ConfigureServices((services) => { services.AddAzureOrbitalFramework(); From eb215e36db8de41b9fd78b94b5818e67c453a0a7 Mon Sep 17 00:00:00 2001 From: Ryan Campbell Date: Fri, 2 Aug 2024 03:13:03 +0000 Subject: [PATCH 4/4] copy and paste dust bunny --- src/Program.cs | 3 --- test/debugClient/Program.cs | 3 --- test/integrationTests/TestSharedContext.cs | 3 --- 3 files changed, 9 deletions(-) diff --git a/src/Program.cs b/src/Program.cs index 7984ba6..a24be61 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -13,9 +13,6 @@ public static void Main(string[] args) { // 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); - // Build the configuration - build.Configuration.Build(); - builder.WebHost.ConfigureKestrel(options => options.ListenAnyIP(50051, o => o.Protocols = HttpProtocols.Http2)) .ConfigureServices((services) => { services.AddAzureOrbitalFramework(); diff --git a/test/debugClient/Program.cs b/test/debugClient/Program.cs index bbb526c..934d26a 100644 --- a/test/debugClient/Program.cs +++ b/test/debugClient/Program.cs @@ -13,9 +13,6 @@ public static void Main(string[] args) { // 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); - // Build the configuration - build.Configuration.Build(); - builder.WebHost.ConfigureKestrel(options => options.ListenAnyIP(50051, o => o.Protocols = HttpProtocols.Http2)) .ConfigureServices((services) => { services.AddAzureOrbitalFramework(); diff --git a/test/integrationTests/TestSharedContext.cs b/test/integrationTests/TestSharedContext.cs index fab52ee..92bceef 100644 --- a/test/integrationTests/TestSharedContext.cs +++ b/test/integrationTests/TestSharedContext.cs @@ -35,9 +35,6 @@ public TestSharedContext() { // 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); - // Build the configuration - build.Configuration.Build(); - builder.WebHost.ConfigureKestrel(options => options.ListenAnyIP(50051, o => o.Protocols = HttpProtocols.Http2)) .ConfigureServices((services) => { services.AddAzureOrbitalFramework();