Commit cac58eaa authored by xenolf's avatar xenolf

Update to latest lego changes

parent 9a4e26a5
...@@ -7,6 +7,7 @@ import ( ...@@ -7,6 +7,7 @@ import (
"encoding/json" "encoding/json"
"errors" "errors"
"io/ioutil" "io/ioutil"
"log"
"net/http" "net/http"
"os" "os"
"strings" "strings"
...@@ -83,9 +84,11 @@ func Activate(configs []server.Config) ([]server.Config, error) { ...@@ -83,9 +84,11 @@ func Activate(configs []server.Config) ([]server.Config, error) {
} }
// client is ready, so let's get free, trusted SSL certificates! yeah! // client is ready, so let's get free, trusted SSL certificates! yeah!
certificates, err := obtainCertificates(client, serverConfigs) certificates, failures := obtainCertificates(client, serverConfigs)
if err != nil { if len(failures) > 0 {
return configs, errors.New("error getting certs: " + err.Error()) for k, v := range failures {
log.Printf("[%s] Failed to get a certificate: %s", k, v)
}
} }
// ... that's it. save the certs, keys, and metadata files to disk // ... that's it. save the certs, keys, and metadata files to disk
...@@ -234,19 +237,14 @@ func newClient(leEmail string) (*acme.Client, error) { ...@@ -234,19 +237,14 @@ func newClient(leEmail string) (*acme.Client, error) {
// obtainCertificates obtains certificates from the CA server for // obtainCertificates obtains certificates from the CA server for
// the configurations in serverConfigs using client. // the configurations in serverConfigs using client.
func obtainCertificates(client *acme.Client, serverConfigs []*server.Config) ([]acme.CertificateResource, error) { func obtainCertificates(client *acme.Client, serverConfigs []*server.Config) ([]acme.CertificateResource, map[string]error) {
// collect all the hostnames into one slice // collect all the hostnames into one slice
var hosts []string var hosts []string
for _, cfg := range serverConfigs { for _, cfg := range serverConfigs {
hosts = append(hosts, cfg.Host) hosts = append(hosts, cfg.Host)
} }
certificates, err := client.ObtainCertificates(hosts, true) return client.ObtainCertificates(hosts, true)
if err != nil {
return nil, errors.New("error obtaining certs: " + err.Error())
}
return certificates, nil
} }
// saveCertificates saves each certificate resource to disk. This // saveCertificates saves each certificate resource to disk. This
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment