/// <summary> /// This method gets called by the runtime and is used to configure the HTTP request pipeline. /// </summary> /// <param name="app">The application builder.</param> /// <param name="env">Environemnt information wrapper.</param> /// <param name="clientFactory">A factory for creating Http Clients</param> /// <param name="registry">The simulation registry containing configuration information.</param> /// <param name="engine">The simulation engine to execute startup processes from.</param> public void Configure(IApplicationBuilder app, IHostingEnvironment env, IHttpClientFactory clientFactory, IRegistry registry, IEngine engine) { _ = app ?? throw new ArgumentNullException(nameof(app)); _ = env ?? throw new ArgumentNullException(nameof(env)); _ = clientFactory ?? throw new ArgumentNullException(nameof(clientFactory)); _ = registry ?? throw new ArgumentNullException(nameof(registry)); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } // Injecting registry here to ensure it is added from the second, more locally scoped, instance container. registry.ConfigureHttpClients(clientFactory); app.UseMvc(); app.UseHealthChecks("/health"); // Trigger startup processes engine.ProcessStartupActionsAsync(); }