Add a helper function

This commit is contained in:
Andrew Ayer
2023-10-29 08:10:49 -04:00
parent 07bf0cfe2f
commit b957791a5f
2 changed files with 10 additions and 6 deletions

View File

@@ -12,6 +12,7 @@ package monitor
import (
"crypto/rand"
"encoding/hex"
"os"
)
const mailDateFormat = "Mon, 2 Jan 2006 15:04:05 -0700"
@@ -23,3 +24,11 @@ func generateMessageID() string {
}
return hex.EncodeToString(randomBytes[:]) + "@selfhosted.certspotter.org"
}
func sendmailPath() string {
if envVar := os.Getenv("SENDMAIL_PATH"); envVar != "" {
return envVar
} else {
return "/usr/sbin/sendmail"
}
}