Add support for comparing duration before certificate expiration

This commit is contained in:
Elouan Martinet
2020-11-15 18:33:09 +01:00
parent d50721c8f0
commit 7d97e83875
3 changed files with 14 additions and 0 deletions

View File

@ -35,6 +35,11 @@ const (
// Values that could replace the placeholder: true, false
ConnectedPlaceHolder = "[CONNECTED]"
// CertificateExpirationPlaceholder is a placeholder for the duration before certificate expiration, in milliseconds.
//
// Values that could replace the placeholder: 4461677039 (~52 days)
CertificateExpirationPlaceholder = "[CERTIFICATE_EXPIRATION]"
// LengthFunctionPrefix is the prefix for the length function
LengthFunctionPrefix = "len("
@ -142,6 +147,8 @@ func sanitizeAndResolve(list []string, result *Result) []string {
element = body
case ConnectedPlaceHolder:
element = strconv.FormatBool(result.Connected)
case CertificateExpirationPlaceholder:
element = strconv.FormatInt(int64(result.CertificateExpiration.Milliseconds()), 10)
default:
// if contains the BodyPlaceHolder, then evaluate json path
if strings.Contains(element, BodyPlaceHolder) {