using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;

namespace TEAMModelGrpc
{
    public class Program
    {
        public static void Main(string[] args)
        {
            CreateHostBuilder(args).Build().Run();
        }

        // Additional configuration is required to successfully run gRPC on macOS.
        // For instructions on how to configure Kestrel and gRPC clients on macOS, visit https://go.microsoft.com/fwlink/?linkid=2099682
        public static IHostBuilder CreateHostBuilder(string[] args) {
            //var config = new ConfigurationBuilder()
            //            .SetBasePath(Directory.GetCurrentDirectory())
            //            .AddJsonFile("hostsettings.json", optional: true, reloadOnChange: true)//
            //            .AddCommandLine(args)
            //            .Build();
            return Host.CreateDefaultBuilder(args)
                    .ConfigureWebHostDefaults(webBuilder =>
                    {
                        //webBuilder.UseKestrel(option =>
                        //{
                        //    option.Listen(System.Net.IPAddress.Any, 5000, (lop) =>
                        //    {
                        //        lop.UseHttps("3518566__teammodel.cn.pfx", "cJNBFxFs");

                        //        //参数为证书文件名称，证书密码
                        //    });
                        //});
                        //webBuilder.UseConfiguration(config);
                        //webBuilder.UseIISIntegration();
                        //webBuilder.UseUrls("https://0.0.0.0:443");
                        //可以不通过配置文件，通过UseUrls该方法指定一组url以分号分隔
                        //webBuilder.UseKestrel(opt => {
                        //    opt.ConfigureHttpsDefaults("teammodel.cn.pfx");
                        //});
                        webBuilder.UseStartup<Startup>();
                    });
        }

           
    }
}
