mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-04-22 19:52:50 +08:00

* failing test * failing test but needs real butterfly server running..need to fix that...also worked out ive broken tracing...yey * brought in butterfly source code so i can work out how to write acceptance tests for this... * fixed the bug but still need to fix tracing * tracing working again across services but need to make tracing hook into new Ocelot middleware as it still uses asp.net middleware * removed butterfly libs brought in for testing
62 lines
2.3 KiB
C#
62 lines
2.3 KiB
C#
using System.IO;
|
|
using Microsoft.AspNetCore.Hosting;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Logging;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Ocelot.DependencyInjection;
|
|
using Ocelot.Middleware;
|
|
|
|
namespace Ocelot.ManualTest
|
|
{
|
|
public class Program
|
|
{
|
|
public static void Main(string[] args)
|
|
{
|
|
new WebHostBuilder()
|
|
.UseKestrel()
|
|
.UseContentRoot(Directory.GetCurrentDirectory())
|
|
.ConfigureAppConfiguration((hostingContext, config) =>
|
|
{
|
|
config
|
|
.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath)
|
|
.AddJsonFile("appsettings.json", true, true)
|
|
.AddJsonFile($"appsettings.{hostingContext.HostingEnvironment.EnvironmentName}.json", true, true)
|
|
.AddJsonFile("configuration.json")
|
|
.AddEnvironmentVariables();
|
|
})
|
|
.ConfigureServices(s => {
|
|
s.AddAuthentication()
|
|
.AddJwtBearer("TestKey", x =>
|
|
{
|
|
x.Authority = "test";
|
|
x.Audience = "test";
|
|
});
|
|
|
|
s.AddOcelot()
|
|
.AddCacheManager(x =>
|
|
{
|
|
x.WithDictionaryHandle();
|
|
})
|
|
.AddOpenTracing(option =>
|
|
{
|
|
option.CollectorUrl = "http://localhost:9618";
|
|
option.Service = "Ocelot.ManualTest";
|
|
})
|
|
.AddAdministration("/administration", "secret");
|
|
})
|
|
.ConfigureLogging((hostingContext, logging) =>
|
|
{
|
|
logging.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));
|
|
logging.AddConsole();
|
|
})
|
|
.UseIISIntegration()
|
|
.Configure(app =>
|
|
{
|
|
app.UseOcelot().Wait();
|
|
})
|
|
.Build()
|
|
.Run();
|
|
}
|
|
}
|
|
}
|