Skip to content

Commit

Permalink
Update Startup.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeWalker authored Nov 22, 2024
1 parent afe59b5 commit 96596b2
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions cpu-app/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
});
}
}
}
}

0 comments on commit 96596b2

Please sign in to comment.