You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
778 B
C#

3 years ago
using Microsoft.Extensions.Configuration;
using System;
namespace Common.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;
}
}
}