Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change object IWebHostEnvironment for new IHostEnvironment of net core #111

Merged
merged 20 commits into from
Jun 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions demo/ApiGateway/Program.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using MMLib.SwaggerForOcelot.DependencyInjection;

namespace ApiGateway
Expand All @@ -12,8 +13,8 @@ public static void Main(string[] args)
CreateWebHostBuilder(args).Build().Run();
}

public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
public static IHostBuilder CreateWebHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureAppConfiguration((hostingContext, config) =>
{
config
Expand All @@ -25,6 +26,6 @@ public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
.AddOcelotWithSwaggerSupport(folder: "Configuration")
.AddEnvironmentVariables();
})
.UseStartup<Startup>();
.ConfigureWebHostDefaults(webBuilder => webBuilder.UseStartup<Startup>());
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Kros.Extensions;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using MMLib.SwaggerForOcelot.Configuration;
using Newtonsoft.Json;
using System;
Expand Down Expand Up @@ -28,7 +29,7 @@ public static class ConfigurationBuilderExtensions
/// <returns>a Object IConfigurationBuilder</returns>
public static IConfigurationBuilder AddOcelotWithSwaggerSupport(
this IConfigurationBuilder builder,
IWebHostEnvironment environment = null,
IHostEnvironment environment = null,
string folder = "/",
string fileOfSwaggerEndPoints = SwaggerForOcelotFileOptions.SwaggerEndPointsConfigFile)
{
Expand Down