mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-04-05 17:38:01 +08:00
22 lines
786 B
C#
22 lines
786 B
C#
using System;
|
|
using Microsoft.Extensions.Configuration;
|
|
|
|
namespace Infrastructure.Helpers
|
|
{
|
|
public class ConfigHelper
|
|
{
|
|
public static IConfigurationRoot GetConfigRoot()
|
|
{
|
|
var configurationBuilder = new ConfigurationBuilder();
|
|
configurationBuilder.SetBasePath(System.IO.Directory.GetCurrentDirectory())
|
|
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
|
|
.AddJsonFile(
|
|
$"appsettings.{Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") ?? "Development"}.json",
|
|
optional: true)
|
|
.AddEnvironmentVariables();
|
|
|
|
var configuration = configurationBuilder.Build();
|
|
return configuration;
|
|
}
|
|
}
|
|
} |