add description in english
This commit is contained in:
@@ -1,8 +1,15 @@
|
||||
namespace Hua.DDNS.Common.Config.Options
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// app configuration class
|
||||
/// </summary>
|
||||
public class AppOption
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// domain configuration
|
||||
/// </summary>
|
||||
public DomainOption Domain { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,17 +6,18 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Hua.DDNS.Common.Config.Options
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// domain configuration class
|
||||
/// </summary>
|
||||
public class DomainOption
|
||||
{
|
||||
/// <summary>
|
||||
/// 平台
|
||||
/// platform from [Ali,Tencent]
|
||||
/// </summary>
|
||||
public string Platform { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Id
|
||||
/// Id, the id and key from AliCould or DnsPod
|
||||
/// </summary>
|
||||
public string Id { get; set; }
|
||||
|
||||
@@ -26,25 +27,15 @@ namespace Hua.DDNS.Common.Config.Options
|
||||
public string Key { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 域名
|
||||
/// domain
|
||||
/// </summary>
|
||||
public string domain { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 子域列表
|
||||
/// sub domain, eg. www,git
|
||||
/// </summary>
|
||||
public string[] subDomainArray { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 解析记录类型
|
||||
/// </summary>
|
||||
public string type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 间隔时间 秒
|
||||
/// </summary>
|
||||
public string time { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,13 +2,19 @@
|
||||
|
||||
namespace Hua.DDNS.Common.Config
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// this is a strongly-typed configuration provider
|
||||
/// </summary>
|
||||
public class SettingProvider
|
||||
{
|
||||
private readonly AppOption _app;
|
||||
private readonly IConfiguration _configuration;
|
||||
public SettingProvider(IConfiguration configuration)
|
||||
{
|
||||
_configuration = configuration;
|
||||
_app = new AppOption();
|
||||
configuration.GetSection("App").Bind(_app);
|
||||
_configuration.GetSection("App").Bind(_app);
|
||||
}
|
||||
|
||||
public AppOption App => _app;
|
||||
|
||||
@@ -122,7 +122,7 @@ namespace Hua.DDNS.Jobs
|
||||
Type = aliDomainRecord.Type,
|
||||
Value = CurrentIpv4Address,
|
||||
});
|
||||
_logger.LogInformation($"更新域名解析记录{aliDomainRecord.Value} To {CurrentIpv4Address}");
|
||||
_logger.LogInformation($"Update SubDomain[{aliDomainRecord.RR}.{aliDomainRecord.DomainName}] Value {aliDomainRecord.Value} To {CurrentIpv4Address}");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
public class Cache
|
||||
{
|
||||
/// <summary>
|
||||
/// Tocken
|
||||
/// Token
|
||||
/// </summary>
|
||||
public static string Tocken { get; set; } = null;
|
||||
public static string? Token { get; set; } = null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,24 +1,17 @@
|
||||
using System.Configuration;
|
||||
using Hua.DDNS.Common;
|
||||
using Hua.DDNS.Common.Config;
|
||||
using Hua.DDNS.Common.Http;
|
||||
using Hua.DDNS.Jobs;
|
||||
using Quartz;
|
||||
using Serilog;
|
||||
using Serilog.Extensions.Logging;
|
||||
|
||||
namespace Hua.DDNS.Start
|
||||
{
|
||||
public static class Program
|
||||
{
|
||||
public static async Task Main(string[] args)
|
||||
{
|
||||
await CreateHostBuilder(args).Build().RunAsync();
|
||||
}
|
||||
|
||||
private static IHostBuilder CreateHostBuilder(string[] args) =>
|
||||
Host.CreateDefaultBuilder(args)
|
||||
.UseWindowsService()
|
||||
.UseSerilog()
|
||||
.ConfigureServices((hostContext, services) =>
|
||||
{
|
||||
Log.Logger = new LoggerConfiguration()
|
||||
.Enrich.FromLogContext()
|
||||
@@ -27,6 +20,24 @@ namespace Hua.DDNS.Start
|
||||
Path.Combine("Log\\log-.log"),
|
||||
rollingInterval: RollingInterval.Day)
|
||||
.CreateLogger();
|
||||
|
||||
await CreateHostBuilder(args).Build().RunAsync();
|
||||
}
|
||||
|
||||
private static IHostBuilder CreateHostBuilder(string[] args) =>
|
||||
Host.CreateDefaultBuilder(args)
|
||||
.UseWindowsService()
|
||||
.UseSerilog()
|
||||
.ConfigureAppConfiguration((context, config) =>
|
||||
{
|
||||
// clear all config provider
|
||||
config.Sources.Clear();
|
||||
config
|
||||
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
||||
.AddJsonFile($"appsettings.{context.HostingEnvironment.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
||||
})
|
||||
.ConfigureServices((hostContext, services) =>
|
||||
{
|
||||
ConfigDi(hostContext, services);
|
||||
ConfigQuartz(hostContext, services);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user