]> git.somenet.org - pub/jan/aic18.git/blob - service-reporting/Startup.cs
Merge branch 'vagrant-provisioning' into 'master'
[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
37         // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
38         public void Configure(IApplicationBuilder app, IHostingEnvironment env)
39         {
40             if (env.IsDevelopment())
41             {
42                 app.UseDeveloperExceptionPage();
43             }
44             else
45             {
46                 // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
47                 app.UseHsts();
48             }
49
50             app.UseHttpsRedirection();
51             app.UseMvc();
52         }
53     }
54 }