mirror of https://github.com/abpframework/abp.git
4 changed files with 31 additions and 2 deletions
@ -0,0 +1,17 @@ |
|||
using Microsoft.Extensions.Configuration; |
|||
|
|||
namespace Microsoft.AspNetCore.Hosting |
|||
{ |
|||
public static class AbpHostingEnvironmentExtensions |
|||
{ |
|||
public static IConfigurationRoot GetConfiguration(IHostingEnvironment env, string fileName = "appsettings") |
|||
{ |
|||
var builder = new ConfigurationBuilder() |
|||
.SetBasePath(env.ContentRootPath) |
|||
.AddJsonFile(fileName + ".json", optional: false, reloadOnChange: true) |
|||
.AddJsonFile($"{fileName}.{env.EnvironmentName}.json", optional: true, reloadOnChange: true); |
|||
|
|||
return builder.Build(); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,12 @@ |
|||
using Microsoft.AspNetCore.Hosting; |
|||
|
|||
namespace Microsoft.Extensions.DependencyInjection |
|||
{ |
|||
public static class AbpAspNetCoreServiceCollectionExtensions |
|||
{ |
|||
public static IHostingEnvironment GetHostingEnvironment(IServiceCollection services) |
|||
{ |
|||
return services.GetSingletonInstance<IHostingEnvironment>(); |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue