healthcheck: add healthcheck to shutdown if cert is expired (#4792)

In certain container set ups, it's useful to optionally have lnd just shutdown if it detects that its certs are expired, as assuming there's a hypervisor to restart the container/pod, then upon restart, lnd will have fully up to date certs.
This commit is contained in:
Marty Jones authored and GitHub committed 2020-12-01 18:34:19 -08:00
1 parent e9b5b2d767
commit c04773963b
4 files changed
+65 -1

No files matched your search

+15
View File
@@ -108,6 +108,15 @@ const (
defaultDiskBackoff = time.Minute
defaultDiskAttempts = 0
// Set defaults for a health check which ensures that the TLS certificate
// is not expired. Although this check is off by default (not all setups
// require it), we still set the other default values so that the health
// check can be easily enabled with sane defaults.
defaultTLSInterval = time.Minute
defaultTLSTimeout = time.Second * 5
defaultTLSBackoff = time.Minute
defaultTLSAttempts = 0
// defaultRemoteMaxHtlcs specifies the default limit for maximum
// concurrent HTLCs the remote party may add to commitment transactions.
// This value can be overridden with --default-remote-max-htlcs.
@@ -457,6 +466,12 @@ func DefaultConfig() Config {
Backoff: defaultDiskBackoff,
},
},
TLSCheck: &lncfg.CheckConfig{
Interval: defaultTLSInterval,
Timeout: defaultTLSTimeout,
Attempts: defaultTLSAttempts,
Backoff: defaultTLSBackoff,
},
},
MaxOutgoingCltvExpiry: htlcswitch.DefaultMaxOutgoingCltvExpiry,
MaxChannelFeeAllocation: htlcswitch.DefaultMaxLinkFeeAllocation,