初始化

This commit is contained in:
2025-12-11 14:04:39 +08:00
commit 1f65bbf628
2676 changed files with 838983 additions and 0 deletions

69
Common/ReadConfig.cs Normal file
View File

@@ -0,0 +1,69 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Extensions.Configuration;
namespace LogCap.Common
{
public class ReadConfig
{
public static ReadConfig Instance = new ReadConfig();
public IConfiguration? Configuration { get; set; }
public string? MySQLConnectionString { get; set; }
public string? get_monitor_filter { get; set; }
public string? get_session_expire_minutes { get; set; }
public string? get_redis_server_session { get; set; }
public string? get_redis_auth { get; set; }
public string? get_redis_max_read_pool { get; set; }
public string? get_redis_max_write_pool { get; set; }
public string? get_debug_log_report_url { get; set; }
public string? get_debug_log_report_mqtt_topic { get; set; }
public string? monitor_log_expire_minutes { get; set; }
public string? monitor_server_ip { get; set; }
public int monitor_server_port { get; set; }
public string? CRICS_URL { get; set; }
public string? MQTT_ServerIP { get; set; }
public int? MQTT_ServerPort { get; set; }
public string? MQTT_User { get; set; }
public string? MQTT_PassWord { get; set; }
public ReadConfig()
{
Configuration = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()).AddJsonFile("appsettings.json").Build();
MySQLConnectionString = Configuration.GetConnectionString("SQLServerConnectionString");
get_monitor_filter = Configuration.GetSection("monitor_filter").Value;
get_session_expire_minutes = Configuration.GetSection("session_expire_minutes").Value;
get_redis_server_session = Configuration.GetSection("redis_server_session").Value;
get_redis_auth = Configuration.GetSection("get_redis_auth").Value;
get_redis_max_read_pool = Configuration.GetSection("redis_max_read_pool").Value;
get_redis_max_write_pool = Configuration.GetSection("redis_max_write_pool").Value;
monitor_log_expire_minutes = Configuration.GetSection("monitor_log_expire_minutes").Value;
get_debug_log_report_url = Configuration.GetSection("debug_log_report_url").Value;
get_debug_log_report_mqtt_topic = Configuration.GetSection("debug_log_report_mqtt_topic").Value;
monitor_server_ip = Configuration.GetSection("monitor_server_ip").Value;
int i = 3339;
int.TryParse(Configuration.GetSection("monitor_server_port").Value, out i);
monitor_server_port = i;
MQTT_ServerIP = Configuration.GetSection("MQTT_ServerIP").Value;
int p = 1883;
int.TryParse(Configuration.GetSection("MQTT_ServerPort").Value, out p);
MQTT_ServerPort = p;
CRICS_URL = Configuration.GetSection("CRICS_URL").Value;
MQTT_User = Configuration.GetSection("MQTT_User").Value;
MQTT_PassWord = Configuration.GetSection("MQTT_PWD").Value;
}
}
}