mirror of
https://github.com/ZuneDev/ZuneNetApi.git
synced 2026-07-27 13:13:20 -07:00
42 lines
1.4 KiB
C#
42 lines
1.4 KiB
C#
using Microsoft.AspNetCore.Hosting;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Hosting;
|
|
using Zune.Net;
|
|
|
|
namespace CommerceZuneNet
|
|
{
|
|
public class Program
|
|
{
|
|
public static void Main(string[] args)
|
|
{
|
|
CreateHostBuilder(args).Build().Run();
|
|
}
|
|
|
|
public static IHostBuilder CreateHostBuilder(string[] args)
|
|
{
|
|
Config cfg = new(args);
|
|
|
|
return Host.CreateDefaultBuilder(args)
|
|
.ConfigureWebHostDefaults(webBuilder =>
|
|
{
|
|
webBuilder.UseStartup<Startup>();
|
|
if (cfg.Host != null)
|
|
webBuilder.UseUrls($"http://{cfg.Host}:{cfg.Port}", $"https://{cfg.Host}:{cfg.SslPort}");
|
|
})
|
|
.ConfigureAppConfiguration((hostingContext, config) =>
|
|
{
|
|
var env = hostingContext.HostingEnvironment;
|
|
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
|
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
|
config.AddEnvironmentVariables();
|
|
})
|
|
.ConfigureServices((ctx, s) =>
|
|
{
|
|
s.AddSingleton(sp => cfg);
|
|
})
|
|
.ConfigureZuneDB();
|
|
}
|
|
}
|
|
}
|