• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Sholtee / warehouse / 144

05 May 2025 06:20AM UTC coverage: 92.866% (-0.2%) from 93.038%
144

push

appveyor

Sholtee
do not include Server header in the response

1471 of 1584 relevant lines covered (92.87%)

0.93 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

75.86
/SRC/App/Warehouse.Host/Program.cs
1
/********************************************************************************
2
* Program.cs                                                                    *
3
*                                                                               *
4
* Author: Denes Solti                                                           *
5
* Project: Warehouse API (boilerplate)                                          *
6
* License: MIT                                                                  *
7
********************************************************************************/
8
using System;
9
using System.Net;
10
using System.Security.Cryptography.X509Certificates;
11

12
using Amazon;
13
using Microsoft.AspNetCore.Hosting;
14
using Microsoft.Extensions.Configuration;
15
using Microsoft.Extensions.DependencyInjection;
16
using Microsoft.Extensions.Hosting;
17
using Microsoft.Extensions.Logging;
18
using Serilog;
19
using Serilog.Events;
20
using ServiceStack.Logging.Serilog;
21
using ServiceStack.OrmLite;
22

23
namespace Warehouse.Host
24
{
25
    using Infrastructure.Config;
26

27
    internal sealed class Program
28
    {
29
        public static void Main(string[] args) => new HostBuilder()
1✔
30
            .ConfigureHostConfiguration
1✔
31
            (
1✔
32
                configBuilder => configBuilder
1✔
33
                    .AddCommandLine(args)
1✔
34
                    .AddEnvironmentVariables(prefix: "ASPNETCORE_")
1✔
35
                    .AddLiteralEnvironmentVariables(prefix: "WAREHOUSE_")
1✔
36
            )
1✔
37
            .ConfigureAppConfiguration
1✔
38
            (
1✔
39
                static (context, configBuilder) => configBuilder
1✔
40
                    .SetBasePath(Environment.CurrentDirectory)
1✔
41
                    .AddJsonFile("appsettings.json")
1✔
42
                    .AddJsonFile($"appsettings.{context.HostingEnvironment.EnvironmentName}.json", optional: true)
1✔
43
            )
1✔
44
            .ConfigureLogging
1✔
45
            (
1✔
46
                static (context, loggerBuilder) =>
1✔
47
                {
1✔
48
                    loggerBuilder.ClearProviders();
1✔
49

1✔
50
                    Serilog.ILogger logger = new LoggerConfiguration()
1✔
51
                        .ReadFrom
1✔
52
                        .Configuration(context.Configuration)
1✔
53
                        .CreateLogger();
1✔
54

1✔
55
                    loggerBuilder.AddSerilog(logger);
1✔
56
                    OrmLiteConfig.ResetLogFactory(new SerilogFactory(logger));
1✔
57

1✔
58
                    if (logger.IsEnabled(LogEventLevel.Debug))
1✔
59
                    {
1✔
60
                        AWSConfigs.LoggingConfig.LogTo = LoggingOptions.Console;
1✔
61
                    }
1✔
62
                }
1✔
63
            )
1✔
64
            .ConfigureWebHostDefaults
1✔
65
            (
1✔
66
                static webBuilder => webBuilder.UseStartup<Startup>().ConfigureKestrel
1✔
67
                (
1✔
68
                    static (context, serverOpts) =>
1✔
69
                    {
×
70
                        serverOpts.AddServerHeader = false;
×
71
                        serverOpts.Listen
×
72
                        (
×
73
                            IPAddress.Any,
×
74
                            context.Configuration.GetValue("WAREHOUSE_SERVICE_PORT", 1986),
×
75
                            static listenOpts => listenOpts.UseHttps
×
76
                            (
×
77
                                listenOpts
×
78
                                    .ApplicationServices
×
79
                                    .GetRequiredKeyedService<X509Certificate2>("warehouse-app-cert")
×
80
                            )
×
81
                        );
×
82
                    }
×
83
                )    
1✔
84
            )
1✔
85
            .Build()
1✔
86
            .Run();
1✔
87
    }
88
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc