SOFTLAYER: Fixed Lets Encrypt Certificate issue #668 (#669)

This commit is contained in:
Saurabh Gupta 2020-02-28 21:42:56 +05:30 committed by GitHub
parent c98b922170
commit 99cef24d8f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -183,7 +183,7 @@ func (s *SoftLayer) getExistingRecords(domain *datatypes.Dns_Domain) ([]*models.
}
func (s *SoftLayer) createRecordFunc(desired *models.RecordConfig, domain *datatypes.Dns_Domain) func() error {
var ttl, preference, domainID int = int(desired.TTL), int(desired.MxPreference), *domain.Id
var ttl, preference, domainID int = verifyMinTTL(int(desired.TTL)), int(desired.MxPreference), *domain.Id
var weight, priority, port int = int(desired.SrvWeight), int(desired.SrvPriority), int(desired.SrvPort)
var host, data, newType string = desired.GetLabel(), desired.GetTargetField(), desired.Type
var err error
@ -253,7 +253,7 @@ func (s *SoftLayer) deleteRecordFunc(resID int) func() error {
}
func (s *SoftLayer) updateRecordFunc(existing *datatypes.Dns_Domain_ResourceRecord, desired *models.RecordConfig) func() error {
var ttl, preference int = int(desired.TTL), int(desired.MxPreference)
var ttl, preference int = verifyMinTTL(int(desired.TTL)), int(desired.MxPreference)
var priority, weight, port int = int(desired.SrvPriority), int(desired.SrvWeight), int(desired.SrvPort)
return func() error {
@ -369,3 +369,12 @@ func (s *SoftLayer) updateRecordFunc(existing *datatypes.Dns_Domain_ResourceReco
return err
}
}
func verifyMinTTL(ttl int) int {
const minTTL = 60
if ttl < minTTL {
fmt.Printf("\nMODIFY TTL to Min supported TTL value: (ttl=%d) -> (ttl=%d)\n", ttl, minTTL)
return minTTL
}
return ttl
}