]> git.somenet.org - pub/jan/aic18.git/blob - service-reporting/Startup.cs
Revert "added package-lock"
[pub/jan/aic18.git] / service-reporting / Startup.cs
1 using System;
2 using System.Collections.Generic;
3 using System.IO;
4 using System.Linq;
5 using System.Threading.Tasks;
6 using DinkToPdf;
7 using DinkToPdf.Contracts;
8 using Microsoft.AspNetCore.Builder;
9 using Microsoft.AspNetCore.Hosting;
10 using Microsoft.AspNetCore.HttpsPolicy;
11 using Microsoft.AspNetCore.Mvc;
12 using Microsoft.Extensions.Configuration;
13 using Microsoft.Extensions.DependencyInjection;
14 using Microsoft.Extensions.Logging;
15 using Microsoft.Extensions.Options;
16 using PdfService.Utility;
17
18 namespace PdfService
19 {
20     public class Startup
21     {
22         public Startup(IConfiguration configuration)
23         {
24             Configuration = configuration;
25         }
26
27         public IConfiguration Configuration { get; }
28
29         // This method gets called by the runtime. Use this method to add services to the container.
30         public void ConfigureServices(IServiceCollection services)
31         {
32             services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
33
34             services.AddSingleton(typeof(IConverter), new SynchronizedConverter(new PdfTools()));
35
36             services.AddHealthChecks();
37         }
38
39         // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
40         public void Configure(IApplicationBuilder app, IHostingEnvironment env)
41         {
42             if (env.IsDevelopment())
43             {
44                 app.UseDeveloperExceptionPage();
45             }
46             else
47             {
48                 // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
49                 app.UseHsts();
50             }
51
52             app.UseHealthChecks("/health");
53             app.UseHttpsRedirection();
54             app.UseMvc();
55         }
56     }
57 }