-
Notifications
You must be signed in to change notification settings - Fork 838
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
44 changed files
with
585 additions
and
1,516 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,20 @@ | ||
using Microsoft.AspNetCore.Hosting; | ||
using Microsoft.Extensions.Hosting; | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
using Microsoft.AspNetCore.Builder; | ||
using Microsoft.Extensions.DependencyInjection; | ||
|
||
namespace BasicYARPSample | ||
{ | ||
public class Program | ||
{ | ||
public static void Main(string[] args) | ||
{ | ||
// Create a Kestrel web server, and tell it to use the Startup class | ||
// for the service configuration | ||
var myHostBuilder = Host.CreateDefaultBuilder(args); | ||
myHostBuilder.ConfigureWebHostDefaults(webHostBuilder => | ||
{ | ||
webHostBuilder.UseStartup<Startup>(); | ||
}); | ||
var myHost = myHostBuilder.Build(); | ||
myHost.Run(); | ||
} | ||
} | ||
} | ||
var builder = WebApplication.CreateBuilder(args); | ||
|
||
builder.Services.AddControllers(); | ||
// Add the reverse proxy capability to the server | ||
builder.Services.AddReverseProxy() | ||
// Initialize the reverse proxy from the "ReverseProxy" section of configuration | ||
.LoadFromConfig(builder.Configuration.GetSection("ReverseProxy")); | ||
|
||
var app = builder.Build(); | ||
|
||
// Register the reverse proxy routes | ||
app.MapReverseProxy(); | ||
|
||
app.Run(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,32 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
using System; | ||
using System.Diagnostics; | ||
using Microsoft.AspNetCore.Builder; | ||
using Microsoft.AspNetCore.Hosting; | ||
using Microsoft.Extensions.Configuration; | ||
using Microsoft.Extensions.Hosting; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.Logging; | ||
using Serilog; | ||
using Serilog.Sinks.SystemConsole.Themes; | ||
|
||
namespace Yarp.Kubernetes.Ingress | ||
{ | ||
public static class Program | ||
{ | ||
public static void Main(string[] args) | ||
{ | ||
using var serilog = new LoggerConfiguration() | ||
.MinimumLevel.Debug() | ||
.Enrich.FromLogContext() | ||
.WriteTo.Console(theme: AnsiConsoleTheme.Code) | ||
.CreateLogger(); | ||
var builder = WebApplication.CreateBuilder(args); | ||
|
||
Host.CreateDefaultBuilder(args) | ||
.ConfigureWebHost(webBuilder => | ||
{ | ||
webBuilder.UseKubernetesReverseProxyCertificateSelector(); | ||
}) | ||
.ConfigureAppConfiguration(config => | ||
{ | ||
config.AddJsonFile("/app/config/yarp.json", optional: true); | ||
}) | ||
.ConfigureLogging(logging => | ||
{ | ||
logging.ClearProviders(); | ||
logging.AddSerilog(serilog, dispose: false); | ||
}) | ||
.ConfigureWebHostDefaults(webBuilder => | ||
{ | ||
webBuilder.UseStartup<Startup>(); | ||
}).Build().Run(); | ||
} | ||
} | ||
} | ||
using var serilog = new LoggerConfiguration() | ||
.MinimumLevel.Debug() | ||
.Enrich.FromLogContext() | ||
.WriteTo.Console(theme: AnsiConsoleTheme.Code) | ||
.CreateLogger(); | ||
builder.Logging.ClearProviders(); | ||
builder.Logging.AddSerilog(serilog, dispose: false); | ||
|
||
builder.Configuration.AddJsonFile("/app/config/yarp.json", optional: true); | ||
builder.WebHost.UseKubernetesReverseProxyCertificateSelector(); | ||
builder.Services.AddKubernetesReverseProxy(builder.Configuration); | ||
|
||
var app = builder.Build(); | ||
|
||
app.MapReverseProxy(); | ||
|
||
app.Run(); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,35 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
using System; | ||
using System.Diagnostics; | ||
using Microsoft.AspNetCore.Builder; | ||
using Microsoft.AspNetCore.Hosting; | ||
using Microsoft.Extensions.Hosting; | ||
using Microsoft.Extensions.Configuration; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.Logging; | ||
using Serilog; | ||
using Serilog.Sinks.SystemConsole.Themes; | ||
using Yarp.Kubernetes.Protocol; | ||
|
||
namespace Yarp.Kubernetes.Ingress | ||
{ | ||
public static class Program | ||
{ | ||
public static void Main(string[] args) | ||
{ | ||
using var serilog = new LoggerConfiguration() | ||
.MinimumLevel.Debug() | ||
.Enrich.FromLogContext() | ||
.WriteTo.Console(theme: AnsiConsoleTheme.Code) | ||
.CreateLogger(); | ||
var builder = WebApplication.CreateBuilder(args); | ||
|
||
Host.CreateDefaultBuilder(args) | ||
.ConfigureLogging(logging => | ||
{ | ||
logging.ClearProviders(); | ||
logging.AddSerilog(serilog, dispose: false); | ||
}) | ||
.ConfigureWebHostDefaults(webBuilder => | ||
{ | ||
webBuilder.UseStartup<Startup>(); | ||
}).Build().Run(); | ||
} | ||
} | ||
} | ||
using var serilog = new LoggerConfiguration() | ||
.MinimumLevel.Debug() | ||
.Enrich.FromLogContext() | ||
.WriteTo.Console(theme: AnsiConsoleTheme.Code) | ||
.CreateLogger(); | ||
builder.Logging.ClearProviders(); | ||
builder.Logging.AddSerilog(serilog, dispose: false); | ||
|
||
var services = builder.Services; | ||
services.Configure<ReceiverOptions>(builder.Configuration.Bind); | ||
services.AddHostedService<Receiver>(); | ||
services.AddReverseProxy() | ||
.LoadFromMessages(); | ||
|
||
var app = builder.Build(); | ||
|
||
app.MapReverseProxy(); | ||
|
||
app.Run(); |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.