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