Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

Startup.cs 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. using Luticate2.Auth.Controllers;
  2. using Microsoft.AspNetCore.Builder;
  3. using Microsoft.AspNetCore.Hosting;
  4. using Microsoft.EntityFrameworkCore;
  5. using Microsoft.Extensions.Configuration;
  6. using Microsoft.Extensions.DependencyInjection;
  7. using Microsoft.Extensions.Logging;
  8. using Test.Utils;
  9. using Test.Utils.DataAccess;
  10. using WebTest.Business;
  11. namespace WebTest
  12. {
  13. public class Startup
  14. {
  15. public Startup(IHostingEnvironment env)
  16. {
  17. var builder = new ConfigurationBuilder()
  18. .SetBasePath(env.ContentRootPath)
  19. .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
  20. .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true);
  21. if (env.IsEnvironment("Development"))
  22. {
  23. // This will push telemetry data through Application Insights pipeline faster, allowing you to view results immediately.
  24. builder.AddApplicationInsightsSettings(developerMode: true);
  25. }
  26. builder.AddEnvironmentVariables();
  27. Configuration = builder.Build();
  28. }
  29. public IConfigurationRoot Configuration { get; }
  30. // This method gets called by the runtime. Use this method to add services to the container
  31. public void ConfigureServices(IServiceCollection services)
  32. {
  33. // Add framework services.
  34. services.AddApplicationInsightsTelemetry(Configuration);
  35. services.AddLuticateAuth();
  36. services.AddTransient<PkGuidBusiness>();
  37. services.AddTransient<LuUtilsPkGuidDataAccess>();
  38. services.AddDbContext<LuUtilsDbContext>(options => options.UseNpgsql(Tests.ConnectionString));
  39. services.AddMvc()
  40. .AddLuticateAuth();
  41. }
  42. // This method gets called by the runtime. Use this method to configure the HTTP request pipeline
  43. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
  44. {
  45. loggerFactory.AddConsole(Configuration.GetSection("Logging"));
  46. loggerFactory.AddDebug();
  47. app.UseApplicationInsightsRequestTelemetry();
  48. app.UseApplicationInsightsExceptionTelemetry();
  49. app.UseLuticateAuth();
  50. app.UseMvc();
  51. }
  52. }
  53. }