fixed renewal date computing
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Paul 2021-04-07 12:25:26 +02:00
parent 8898e975e8
commit 6a708d748b

View File

@ -31,11 +31,10 @@ func (u *User) Init(cfg *config.Config) (err error) {
// GetEntry returns requested acme ressource in database relative to domain
func (u *User) GetEntry(cfg *config.Config, domains []string) (Entry cert.Entry, err error) {
requireddate := time.Now().AddDate(0, 0, -cfg.ACME.MaxDaysBefore).Format("2006-01-02")
renewingdate := time.Now().AddDate(0, 0, -cfg.ACME.MaxDaysBefore).Format("2006-01-02")
has, err := cfg.Db.Where("domains = ?", strings.Join(domains, ",")).Where(
"validity_begin >= now()").Where(
"validity_end <= ?::timestamp", requireddate).Where(
"validity_end >= ?::timestamp", renewingdate).Where(
"auth_url = ?", cfg.ACME.AuthURL).Desc(
"id").Get(&Entry)