From 96596b2c7252d327b56e6e432b9474eb654f426b Mon Sep 17 00:00:00 2001 From: George Walker Date: Fri, 22 Nov 2024 14:19:17 -0800 Subject: [PATCH] Update Startup.cs --- cpu-app/Startup.cs | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/cpu-app/Startup.cs b/cpu-app/Startup.cs index 5f3cfe8..8702308 100644 --- a/cpu-app/Startup.cs +++ b/cpu-app/Startup.cs @@ -113,11 +113,15 @@ public void ConfigureServices(IServiceCollection services) services.AddDataProtection().PersistKeysToFileSystem(new DirectoryInfo(Configuration["KEY_RING_DIRECTORY"])); } - // In production, the Angular files will be served from this directory - services.AddSpaStaticFiles(configuration => + if (CurrentEnvironment.IsDevelopment()) { - configuration.RootPath = "ClientApp/dist"; - }); + + // In production, the Angular files will be served from this directory + services.AddSpaStaticFiles(configuration => + { + configuration.RootPath = "ClientApp/dist"; + }); + } // add dynamics database adapter services.AddDatabase(Configuration); @@ -282,18 +286,18 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerF .CreateLogger(); } - app.UseSpa(spa => + if (CurrentEnvironment.IsDevelopment()) { - // To learn more about options for serving an Angular SPA from ASP.NET Core, see https://go.microsoft.com/fwlink/?linkid=864501 - spa.Options.SourcePath = "ClientApp"; - - // Only run the angular CLI Server in Development mode (not staging or test.) - if (env.IsDevelopment()) - { - spa.UseAngularCliServer(npmScript: "start"); - spa.Options.StartupTimeout = TimeSpan.FromSeconds(200); - } - }); + + app.UseSpa(spa => + { + // To learn more about options for serving an Angular SPA from ASP.NET Core, see https://go.microsoft.com/fwlink/?linkid=864501 + spa.Options.SourcePath = "ClientApp"; + + spa.UseAngularCliServer(npmScript: "start"); + spa.Options.StartupTimeout = TimeSpan.FromSeconds(200); + }); + } } } }