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.

78 lines
2.0 KiB
C#

using Ems.CollectService.Common;
using System;
using Microsoft.Extensions.Configuration;
namespace Ems.CollectService.Entity.config
{
public sealed class AppConfig
{
private static readonly Lazy<AppConfig> lazy = new Lazy<AppConfig>(() => new AppConfig());
public static AppConfig Instance
{
get
{
return lazy.Value;
}
}
private IConfiguration _configuration = new ConfigurationBuilder().SetBasePath(Environment.CurrentDirectory)
.AddJsonFile("App.json").Build();
private AppConfig() {}
/// <summary>
/// 监听端口
/// </summary>
public int listenerPort
{
get { return _configuration.GetValue<int>("SystemConfig:listenerPort"); }
}
/// <summary>
/// Mysql地址
/// </summary>
public string mysqlStr
{
get
{
return _configuration.GetValue<string>("SystemConfig:mysqlConnStr");
}
}
/// <summary>
/// 将FFFF虚拟赋值进行过滤
/// </summary>
public decimal virtualValue
{
get { return _configuration.GetValue<decimal>("SystemConfig:virtualValue"); }
}
/// <summary>
/// 是否启用FFFF过滤
/// </summary>
public bool virtualFlag
{
get { return _configuration.GetValue<string>("SystemConfig:virtualFlag") == "是" ? true : false;}
}
/// <summary>
/// 日志文件路径
/// </summary>
public string logFilePath
{
get { return _configuration.GetValue<string>("SystemConfig:logFilePath"); }
}
/// <summary>
/// 日志删除周期
/// </summary>
public long deleteLogTimer
{
get { return _configuration.GetValue<long>("SystemConfig:deleteLogTimer"); }
}
}
}