Example #1
0
 public static IWebHost BuildWebHost(IConfiguration cfg, ServerSettings serverSt, FMSSettings fmsSt, FMSImplementation fmsImpl)
 {
     return(new WebHostBuilder()
            .UseConfiguration(cfg)
            .ConfigureServices(s =>
     {
         s.AddSingleton <FMSImplementation>(fmsImpl);
         s.AddSingleton <FMSSettings>(fmsSt);
         s.AddSingleton <ServerSettings>(serverSt);
     })
            .SuppressStatusMessages(suppressStatusMessages: true)
            .UseKestrel(options =>
     {
         var address = IPAddress.IPv6Any;
         if (!string.IsNullOrEmpty(serverSt.TLSCertFile))
         {
             options.Listen(address, serverSt.Port, listenOptions =>
             {
                 listenOptions.UseHttps(serverSt.TLSCertFile);
             });
         }
         else
         {
             options.Listen(address, serverSt.Port);
         }
     })
            .UseContentRoot(ServerSettings.ContentRootDirectory)
            .UseSerilog()
            .UseStartup <Startup>()
            .Build());
 }
Example #2
0
 public Startup(FMSImplementation fmsImpl, ServerSettings serverSt, FMSSettings fmsSt)
 {
     _fmsImpl  = fmsImpl;
     _serverSt = serverSt;
     _fmsSt    = fmsSt;
 }