mirror of
https://github.com/caddyserver/caddy.git
synced 2025-06-04 19:24:42 +08:00
Pluggable TLS Storage (#913)
* Initial concept for pluggable storage (sans tests and docs) * Add TLS storage docs, test harness, and minor clean up from code review * Fix issue with caddymain's temporary moveStorage * Formatting improvement on struct array literal by removing struct name * Pluggable storage changes: * Change storage interface to persist all site or user data in one call * Add lock/unlock calls for renewal and cert obtaining * Key fields on composite literals
This commit is contained in:
@ -92,11 +92,15 @@ func getCertificate(name string) (cert Certificate, matched, defaulted bool) {
|
||||
//
|
||||
// This function is safe for concurrent use.
|
||||
func CacheManagedCertificate(domain string, cfg *Config) (Certificate, error) {
|
||||
storage, err := StorageFor(cfg.CAUrl)
|
||||
storage, err := cfg.StorageFor(cfg.CAUrl)
|
||||
if err != nil {
|
||||
return Certificate{}, err
|
||||
}
|
||||
cert, err := makeCertificateFromDisk(storage.SiteCertFile(domain), storage.SiteKeyFile(domain))
|
||||
siteData, err := storage.LoadSite(domain)
|
||||
if err != nil {
|
||||
return Certificate{}, err
|
||||
}
|
||||
cert, err := makeCertificate(siteData.Cert, siteData.Key)
|
||||
if err != nil {
|
||||
return cert, err
|
||||
}
|
||||
|
Reference in New Issue
Block a user