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

Sholtee / warehouse / 102

13 Feb 2025 04:13AM UTC coverage: 92.413% (-1.0%) from 93.443%
102

push

appveyor

Sholtee
fix build

1352 of 1463 relevant lines covered (92.41%)

0.92 hits per line

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

80.0
/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: "AWS_")
1✔
36
                    .AddLiteralEnvironmentVariables(prefix: "WAREHOUSE_")
1✔
37
            )
1✔
38
            .ConfigureAppConfiguration
1✔
39
            (
1✔
40
                static (context, configBuilder) => configBuilder
1✔
41
                    .SetBasePath(Environment.CurrentDirectory)
1✔
42
                    .AddJsonFile("appsettings.json")
1✔
43
                    .AddJsonFile($"appsettings.{context.HostingEnvironment.EnvironmentName}.json", optional: true)
1✔
44
            )
1✔
45
            .ConfigureLogging
1✔
46
            (
1✔
47
                static (context, loggerBuilder) =>
1✔
48
                {
1✔
49
                    loggerBuilder.ClearProviders();
1✔
50

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

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

1✔
59
                    if (logger.IsEnabled(LogEventLevel.Debug))
1✔
60
                    {
1✔
61
                        AWSConfigs.LoggingConfig.LogTo = LoggingOptions.Console;
1✔
62
                    }
1✔
63
                }
1✔
64
            )
1✔
65
            .ConfigureWebHostDefaults
1✔
66
            (
1✔
67
                static webBuilder => webBuilder.UseStartup<Startup>().ConfigureKestrel
1✔
68
                (
1✔
69
                    static (context, serverOpts) => serverOpts.Listen
×
70
                    (
×
71
                        IPAddress.Any,
×
72
                        context.Configuration.GetValue("WAREHOUSE_SERVICE_PORT", 1986),
×
73
                        static listenOpts => listenOpts.UseHttps
×
74
                        (
×
75
                            listenOpts
×
76
                                .ApplicationServices
×
77
                                .GetRequiredKeyedService<X509Certificate2>("warehouse-app-cert")
×
78
                        )
×
79
                    )
×
80
                )    
1✔
81
            )
1✔
82
            .Build()
1✔
83
            .Run();
1✔
84
    }
85
}
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