mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-02-24 23:04:40 +08:00
feat: 导入证书支持 IP 证书 (#2959)
This commit is contained in:
parent
dc51148a29
commit
abaa42af88
1 changed files with 9 additions and 1 deletions
|
@ -341,10 +341,18 @@ func (w WebsiteSSLService) Upload(req request.WebsiteSSLUpload) error {
|
|||
} else {
|
||||
newSSL.Organization = cert.Issuer.CommonName
|
||||
}
|
||||
|
||||
var domains []string
|
||||
if len(cert.DNSNames) > 0 {
|
||||
newSSL.PrimaryDomain = cert.DNSNames[0]
|
||||
newSSL.Domains = strings.Join(cert.DNSNames, ",")
|
||||
domains = cert.DNSNames[1:]
|
||||
} else if len(cert.IPAddresses) > 0 {
|
||||
newSSL.PrimaryDomain = cert.IPAddresses[0].String()
|
||||
for _, ip := range cert.IPAddresses[1:] {
|
||||
domains = append(domains, ip.String())
|
||||
}
|
||||
}
|
||||
newSSL.Domains = strings.Join(domains, ",")
|
||||
|
||||
return websiteSSLRepo.Create(context.Background(), newSSL)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue