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

+6
View File
@@ -26,6 +26,8 @@ type HealthCheckConfig struct {
ChainCheck *CheckConfig `group:"chainbackend" namespace:"chainbackend"`
DiskCheck *DiskCheckConfig `group:"diskspace" namespace:"diskspace"`
TLSCheck *CheckConfig `group:"tls" namespace:"tls"`
}
// Validate checks the values configured for our health checks.
@@ -38,6 +40,10 @@ func (h *HealthCheckConfig) Validate() error {
return err
}
if err := h.TLSCheck.validate("tls"); err != nil {
return err
}
if h.DiskCheck.RequiredRemaining < 0 ||
h.DiskCheck.RequiredRemaining >= 1 {