@@ -6,14 +6,17 @@ public class Program {
66 public static void Main ( string [ ] args ) {
77 var builder = WebApplication . CreateBuilder ( args ) ;
88
9+ string _secretDir = Environment . GetEnvironmentVariable ( "SPACEFX_SECRET_DIR" ) ?? throw new Exception ( "SPACEFX_SECRET_DIR environment variable not set" ) ;
910 // Load the configuration being supplicated by the cluster first
10- builder . Configuration . AddJsonFile ( Path . Combine ( "{env:SPACEFX_CONFIG_DIR }", "config" , "appsettings.json" ) , optional : true , reloadOnChange : false ) ;
11+ builder . Configuration . AddJsonFile ( Path . Combine ( $ " { _secretDir } ", "config" , "appsettings.json" ) , optional : false , reloadOnChange : false ) ;
1112
1213 // Load any local appsettings incase they're overriding the cluster values
1314 builder . Configuration . AddJsonFile ( Path . Combine ( Directory . GetCurrentDirectory ( ) , "appsettings.json" ) , optional : true , reloadOnChange : false ) ;
1415
1516 // Load any local appsettings incase they're overriding the cluster values
16- builder . Configuration . AddJsonFile ( Path . Combine ( Directory . GetCurrentDirectory ( ) , "appsettings.{env:DOTNET_ENVIRONMENT}.json" ) , optional : true , reloadOnChange : false ) ;
17+ string ? dotnet_env = Environment . GetEnvironmentVariable ( "DOTNET_ENVIRONMENT" ) ;
18+ if ( ! string . IsNullOrWhiteSpace ( dotnet_env ) )
19+ builder . Configuration . AddJsonFile ( Path . Combine ( Directory . GetCurrentDirectory ( ) , $ "appsettings.{ dotnet_env } .json") , optional : true , reloadOnChange : false ) ;
1720
1821 builder . WebHost . ConfigureKestrel ( options => options . ListenAnyIP ( 50051 , o => o . Protocols = HttpProtocols . Http2 ) )
1922 . ConfigureServices ( ( services ) => {
0 commit comments