// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } var context = app.ApplicationServices.GetService <ChecklistBotContext>(); if (context.Database.EnsureCreated()) { if (context.Database.GetPendingMigrations().Count() > 0) { context.Database.Migrate(); } } app.UseMvc(routes => { routes.MapRoute( name: "bot_endpoint", template: "api/update/" + BotConfig.WebHookUrl, defaults: new { controller = "update", action = "update" }); }); app.UseForwardedHeaders(new ForwardedHeadersOptions() { ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto }); var URLS = app.ServerFeatures.Get <IServerAddressesFeature>().Addresses; ChecklistBotService.SetWebhook(BotConfig.BotToken, BotConfig.BaseUrl + "/api/update/" + BotConfig.WebHookUrl); }
public UpdateController(ChecklistBotService checklistBot, BotConfig botConfig) { _botConfig = botConfig; _checkListBot = checklistBot; }