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.

48 lines
1.2 KiB
C#

using System.IO;
namespace EntrustSettle.Common.AppConfig
{
public class AppSecretConfig
{
private static string Audience_Secret = AppSettings.app(new string[] { "Audience", "Secret" });
private static string Audience_Secret_File = AppSettings.app(new string[] { "Audience", "SecretFile" });
public static string Audience_Secret_String => InitAudience_Secret();
private static string InitAudience_Secret()
{
var securityString = DifDBConnOfSecurity(Audience_Secret_File);
if (!string.IsNullOrEmpty(Audience_Secret_File)&& !string.IsNullOrEmpty(securityString))
{
return securityString;
}
else
{
return Audience_Secret;
}
}
private static string DifDBConnOfSecurity(params string[] conn)
{
foreach (var item in conn)
{
try
{
if (File.Exists(item))
{
return File.ReadAllText(item).Trim();
}
}
catch (System.Exception) { }
}
return "";
}
}
}