fix: couldn't save certificate source

This commit is contained in:
Fu Diwei
2025-01-05 01:16:00 +08:00
parent ddb6a88392
commit 3c70a4f455
3 changed files with 6 additions and 23 deletions

View File

@@ -216,9 +216,9 @@ func apply(option *applyConfig, provider challenge.Provider) (*Certificate, erro
}
challengeOptions := make([]dns01.ChallengeOption, 0)
nameservers := parseNameservers(option.Nameservers)
if len(nameservers) > 0 {
challengeOptions = append(challengeOptions, dns01.AddRecursiveNameservers(nameservers))
if len(option.Nameservers) > 0 {
challengeOptions = append(challengeOptions, dns01.AddRecursiveNameservers(dns01.ParseNameservers(strings.Split(option.Nameservers, ";"))))
challengeOptions = append(challengeOptions, dns01.DisableAuthoritativeNssPropagationRequirement())
}
client.Challenge.SetDNS01Provider(provider, challengeOptions...)
@@ -306,23 +306,6 @@ func getReg(client *lego.Client, sslProvider *SSLProviderConfig, user *applyUser
return reg, nil
}
func parseNameservers(ns string) []string {
nameservers := make([]string, 0)
lines := strings.Split(ns, ";")
for _, line := range lines {
line = strings.TrimSpace(line)
if line == "" {
continue
}
nameservers = append(nameservers, line)
}
return nameservers
}
func parseKeyAlgorithm(algo string) certcrypto.KeyType {
switch algo {
case "RSA2048":

View File

@@ -130,7 +130,7 @@ func (w *WorkflowOutputRepository) Save(ctx context.Context, output *domain.Work
}
certRecord := models.NewRecord(certCollection)
certRecord.Set("source", certificate.Source)
certRecord.Set("source", string(certificate.Source))
certRecord.Set("subjectAltNames", certificate.SubjectAltNames)
certRecord.Set("certificate", certificate.Certificate)
certRecord.Set("privateKey", certificate.PrivateKey)