public static void WebStart(IApplicationBuilder app, IWebHostEnvironment env, IHostApplicationLifetime lifetime) { SignumServer.Start(app, env, typeof(Startup).Assembly); AuthServer.Start(app, () => Starter.Configuration.Value.AuthTokens, "IMPORTANT SECRET FROM Southwind. CHANGE THIS STRING!!!"); CacheServer.Start(app); FilesServer.Start(app); UserQueryServer.Start(app); DashboardServer.Start(app); WordServer.Start(app); ExcelServer.Start(app); ChartServer.Start(app); MapServer.Start(app); ToolbarServer.Start(app); TranslationServer.Start(app, new AlreadyTranslatedTranslator(), new AzureTranslator( () => Starter.Configuration.Value.Translation.AzureCognitiveServicesAPIKey, () => Starter.Configuration.Value.Translation.AzureCognitiveServicesRegion), new DeepLTranslator(() => Starter.Configuration.Value.Translation.DeepLAPIKey) ); //TranslationServer SchedulerServer.Start(app, lifetime); ProcessServer.Start(app); MailingServer.Start(app); ProfilerServer.Start(app); DiffLogServer.Start(app); RestServer.Start(app); RestLogServer.Start(app); PredictorServer.Start(app); WorkflowServer.Start(app); AlertsServer.Start(app); DynamicServer.Start(app); OmniboxServer.Start(app, new EntityOmniboxResultGenenerator(), new DynamicQueryOmniboxResultGenerator(), new ChartOmniboxResultGenerator(), new DashboardOmniboxResultGenerator(DashboardLogic.Autocomplete), new UserQueryOmniboxResultGenerator(UserQueryLogic.Autocomplete), new UserChartOmniboxResultGenerator(UserChartLogic.Autocomplete), new MapOmniboxResultGenerator(type => OperationLogic.TypeOperations(type).Any()), new ReactSpecialOmniboxGenerator() //new HelpModuleOmniboxResultGenerator(), ); //Omnibox ReflectionServer.RegisterLike(typeof(RegisterUserModel), () => true); SignumCultureSelectorFilter.GetCurrentCulture = (ctx) => GetCulture(ctx); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IHostApplicationLifetime lifetime) { app.UseDeveloperExceptionPage(); app.UseStaticFiles(); //HeavyProfiler.Enabled = true; using (HeavyProfiler.Log("Startup")) using (var log = HeavyProfiler.Log("Initial")) { DynamicCode.CodeGenDirectory = env.ContentRootPath + "/CodeGen"; Starter.Start( Configuration.GetConnectionString("ConnectionString"), Configuration.GetValue <bool>("IsPostgres"), Configuration.GetConnectionString("AzureStorageConnectionString"), Configuration.GetValue <string>("BroadcastSecret"), Configuration.GetValue <string>("BroadcastUrls"), detectSqlVersion: false); Statics.SessionFactory = new ScopeSessionFactory(new VoidSessionFactory()); log.Switch("WebStart"); WebStart(app, env, lifetime); log.Switch("UseEndpoints"); //Enable middleware to serve generated Swagger as a JSON endpoint. app.UseSwagger(); app.UseSwaggerUI(c => { c.SwaggerEndpoint("../swagger/v1/swagger.json", "Southwind API"); });//Swagger Configure app.UseWhen(req => req.Request.Path.StartsWithSegments("/api/reflection/types"), builder => { builder.UseResponseCompression(); }); app.UseRouting(); app.UseEndpoints(endpoints => { AlertsServer.MapAlertsHub(endpoints); endpoints.MapControllers(); endpoints.MapControllerRoute( name: "spa-fallback", pattern: "{*url}", constraints: new { url = new NoAPIContraint() }, defaults: new { controller = "Home", action = "Index" }); }); } SignumInitializeFilterAttribute.InitializeDatabase = () => { using (HeavyProfiler.Log("Startup")) using (var log = HeavyProfiler.Log("Initial")) { log.Switch("Initialize"); using (AuthLogic.Disable()) Schema.Current.Initialize(); if (Configuration.GetValue <bool>("StartBackgroundProcesses")) { log.Switch("StartRunningProcesses"); ProcessRunnerLogic.StartRunningProcesses(5 * 1000); log.Switch("StartScheduledTasks"); SchedulerLogic.StartScheduledTasks(); log.Switch("StartRunningEmailSenderAsync"); AsyncEmailSenderLogic.StartRunningEmailSenderAsync(5 * 1000); } SystemEventServer.LogStartStop(app, lifetime); } }; }