Skip to content

Commit 7523c03

Browse files
committed
Added configurable Startup Delay.
1 parent 150baa9 commit 7523c03

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

src/LettuceEncrypt/Internal/AcmeCertificateLoader.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,15 @@ internal class AcmeCertificateLoader(
2626
{
2727
private readonly ILogger _logger = logger;
2828

29-
public TimeSpan RunDelay = TimeSpan.FromSeconds(5);
29+
public TimeSpan RunDelay => options.Value.StartupRunDelay;
3030

3131
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
3232
{
3333
await Task.Run(
3434
async () =>
3535
{
3636
appLifetime.ApplicationStarted.WaitHandle.WaitOne();
37+
3738
_logger.LogInformation("App Started -- Running Acme Certificate Loader in {DelaySeconds} Seconds", this.RunDelay.TotalSeconds);
3839

3940
await Task.Delay(this.RunDelay, stoppingToken);

src/LettuceEncrypt/LettuceEncryptOptions.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,4 +103,10 @@ public bool UseStagingServer
103103
/// Optional EAB (External Account Binding) account credentials used for creating new account.
104104
/// </summary>
105105
public EabCredentials EabCredentials { get; set; } = new();
106+
107+
/// <summary>
108+
/// The delay before the ACME Certificate Renewal Starts After Startup.
109+
/// Default is 5 seconds. But for container setups with healthchecks, may need to be longer.
110+
/// </summary>
111+
public TimeSpan StartupRunDelay { get; set; } = TimeSpan.FromSeconds(5);
106112
}

src/LettuceEncrypt/PublicAPI.Shipped.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ LettuceEncrypt.LettuceEncryptOptions.RenewDaysInAdvance.get -> System.TimeSpan?
7171
LettuceEncrypt.LettuceEncryptOptions.RenewDaysInAdvance.set -> void
7272
LettuceEncrypt.LettuceEncryptOptions.UseStagingServer.get -> bool
7373
LettuceEncrypt.LettuceEncryptOptions.UseStagingServer.set -> void
74+
LettuceEncrypt.LettuceEncryptOptions.StartupRunDelay.get -> System.TimeSpan
75+
LettuceEncrypt.LettuceEncryptOptions.StartupRunDelay.set -> void
7476
Microsoft.AspNetCore.Hosting.LettuceEncryptKestrelHttpsOptionsExtensions
7577
Microsoft.Extensions.DependencyInjection.LettuceEncryptServiceCollectionExtensions
7678
static LettuceEncrypt.FileSystemStorageExtensions.PersistDataToDirectory(this LettuceEncrypt.ILettuceEncryptServiceBuilder! builder, System.IO.DirectoryInfo! directory, string? pfxPassword) -> LettuceEncrypt.ILettuceEncryptServiceBuilder!

0 commit comments

Comments
 (0)