add crontab debug config

This commit is contained in:
nick.yi 2025-09-10 11:45:39 +08:00
parent ae2b5e2287
commit bdaf3cc6b3
2 changed files with 10 additions and 1 deletions

View file

@ -4,9 +4,15 @@ public class CrontabSettings
{
public CrontabBaseSetting EventSubscriber { get; set; } = new();
public CrontabBaseSetting Watcher { get; set; } = new();
public DebugSetting Debug { get; set; } = new();
}
public class CrontabBaseSetting
{
public bool Enabled { get; set; } = true;
}
public class DebugSetting
{
public string AllowRuleTrigger { get; set; } = "";
}

View file

@ -89,7 +89,10 @@ public class CrontabWatcher : BackgroundService
_logger.LogInformation($"The current time matches the cron expression {item}");
#if DEBUG
await HandleCrontabEvent(item);
if (item.Title == settings.Debug.AllowRuleTrigger)
{
await HandleCrontabEvent(item);
}
#else
if (publisher != null)
{