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.
|
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
namespace Admin.Core.Serilog.Es
|
|
|
|
|
{
|
|
|
|
|
public class AppSettingsFileNameConfig
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 配置文件名称常量
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static string AppSettingsFileName = $"appsettings{ GetAppSettingsConfigName() }json";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 根据环境变量定向配置文件名称
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
private static string GetAppSettingsConfigName()
|
|
|
|
|
{
|
|
|
|
|
if (Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") != null
|
|
|
|
|
&& Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") != "")
|
|
|
|
|
{
|
|
|
|
|
return $".{Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT")}.";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return ".";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|