/ Tools / KeyMaker / Program.cs
Program.cs
 1  var builder = WebApplication.CreateBuilder(args);
 2  
 3  var listenPort = Environment.GetEnvironmentVariable("APIPORT");
 4  if (string.IsNullOrEmpty(listenPort)) listenPort = "31090";
 5  
 6  builder.WebHost.ConfigureKestrel((context, options) =>
 7  {
 8      options.ListenAnyIP(Convert.ToInt32(listenPort));
 9  });
10  
11  builder.Services.AddControllers();
12  builder.Services.AddEndpointsApiExplorer();
13  builder.Services.AddSwaggerGen();
14  
15  var app = builder.Build();
16  
17  if (app.Environment.IsDevelopment())
18  {
19      app.UseSwagger();
20      app.UseSwaggerUI();
21  }
22  
23  app.UseHttpsRedirection();
24  
25  app.UseAuthorization();
26  
27  app.MapControllers();
28  
29  Console.WriteLine("KeyMaker listening on port " + listenPort);
30  
31  app.Run();