mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-04-24 04:52:51 +08:00

* Upgrade Projects * Push to trigger builds * Tried Thread Sleep before deleting file * FileDeleteTryCatch * Updated from AspnetCore All to App * Travis version Upgrade (.net core 2.2) * dotnet 2.2.105
44 lines
1.4 KiB
C#
44 lines
1.4 KiB
C#
using Ocelot.Provider.Eureka;
|
|
using Ocelot.Provider.Polly;
|
|
|
|
namespace ApiGateway
|
|
{
|
|
using Microsoft.AspNetCore;
|
|
using Microsoft.AspNetCore.Hosting;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Ocelot.DependencyInjection;
|
|
using Ocelot.Middleware;
|
|
|
|
public class Program
|
|
{
|
|
public static void Main(string[] args)
|
|
{
|
|
BuildWebHost(args).Run();
|
|
}
|
|
|
|
public static IWebHost BuildWebHost(string[] args) =>
|
|
WebHost.CreateDefaultBuilder(args)
|
|
.UseUrls("http://localhost:5000")
|
|
.ConfigureAppConfiguration((hostingContext, config) =>
|
|
{
|
|
config
|
|
.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath)
|
|
.AddJsonFile("appsettings.json", true, true)
|
|
.AddJsonFile($"appsettings.{hostingContext.HostingEnvironment.EnvironmentName}.json", true, true)
|
|
.AddJsonFile("ocelot.json", false, false)
|
|
.AddEnvironmentVariables();
|
|
})
|
|
.ConfigureServices(s =>
|
|
{
|
|
s.AddOcelot()
|
|
.AddEureka()
|
|
.AddPolly();
|
|
})
|
|
.Configure(a =>
|
|
{
|
|
a.UseOcelot().Wait();
|
|
})
|
|
.Build();
|
|
}
|
|
}
|