|
1 |
| -using Microsoft.AspNetCore.Hosting; |
| 1 | +using System.IO; |
| 2 | + |
| 3 | +using Microsoft.AspNetCore.Hosting; |
2 | 4 | using Microsoft.Extensions.Configuration;
|
3 | 5 | using Microsoft.Extensions.Logging;
|
| 6 | + |
4 | 7 | using Ocelot.Administration;
|
5 | 8 | using Ocelot.DependencyInjection;
|
6 | 9 | using Ocelot.Middleware;
|
7 |
| -using System.IO; |
8 | 10 |
|
9 | 11 | namespace AdministrationApi
|
10 | 12 | {
|
11 | 13 | public class Program
|
12 |
| -{ |
13 |
| - public static void Main(string[] args) |
14 | 14 | {
|
15 |
| - new WebHostBuilder() |
16 |
| - .UseKestrel() |
17 |
| - .UseUrls("http://localhost:5000") |
18 |
| - .UseContentRoot(Directory.GetCurrentDirectory()) |
19 |
| - .ConfigureAppConfiguration((hostingContext, config) => |
20 |
| - { |
21 |
| - config |
22 |
| - .SetBasePath(hostingContext.HostingEnvironment.ContentRootPath) |
23 |
| - .AddJsonFile("appsettings.json", true, true) |
24 |
| - .AddJsonFile($"appsettings.{hostingContext.HostingEnvironment.EnvironmentName}.json", true, true) |
25 |
| - .AddJsonFile("ocelot.json") |
26 |
| - .AddEnvironmentVariables(); |
27 |
| - }) |
28 |
| - .ConfigureServices(s => { |
29 |
| - s.AddOcelot() |
30 |
| - .AddAdministration("/administration", "secret"); |
31 |
| - }) |
32 |
| - .ConfigureLogging((hostingContext, logging) => |
33 |
| - { |
34 |
| - logging.AddConsole(); |
35 |
| - }) |
36 |
| - .UseIISIntegration() |
37 |
| - .Configure(app => |
38 |
| - { |
39 |
| - app.UseOcelot().Wait(); |
40 |
| - }) |
41 |
| - .Build() |
42 |
| - .Run(); |
| 15 | + public static void Main(string[] args) |
| 16 | + { |
| 17 | + new WebHostBuilder() |
| 18 | + .UseKestrel() |
| 19 | + .UseUrls("http://localhost:5000") |
| 20 | + .UseContentRoot(Directory.GetCurrentDirectory()) |
| 21 | + .ConfigureAppConfiguration((hostingContext, config) => |
| 22 | + { |
| 23 | + config |
| 24 | + .SetBasePath(hostingContext.HostingEnvironment.ContentRootPath) |
| 25 | + .AddJsonFile("appsettings.json", true, true) |
| 26 | + .AddJsonFile($"appsettings.{hostingContext.HostingEnvironment.EnvironmentName}.json", true, true) |
| 27 | + .AddJsonFile("ocelot.json") |
| 28 | + .AddEnvironmentVariables(); |
| 29 | + }) |
| 30 | + .ConfigureServices(s => |
| 31 | + { |
| 32 | + s.AddOcelot() |
| 33 | + .AddAdministration("/administration", "secret"); |
| 34 | + }) |
| 35 | + .ConfigureLogging((hostingContext, logging) => |
| 36 | + { |
| 37 | + logging.AddConsole(); |
| 38 | + }) |
| 39 | + .UseIISIntegration() |
| 40 | + .Configure(app => |
| 41 | + { |
| 42 | + app.UseOcelot().Wait(); |
| 43 | + }) |
| 44 | + .Build() |
| 45 | + .Run(); |
| 46 | + } |
43 | 47 | }
|
44 | 48 | }
|
45 |
| -} |
|
0 commit comments