Skip to content

Commit

Permalink
feature/letsencrypt_multi_domain - support multiple domain names
Browse files Browse the repository at this point in the history
  • Loading branch information
liorh committed Jan 20, 2022
1 parent c033aa4 commit b97ced1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion go/letsencrypt/internal/producer/producer.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"crypto/rand"
"fmt"
"os"
"strings"

"github.com/go-acme/lego/v4/certificate"
"github.com/go-acme/lego/v4/lego"
Expand Down Expand Up @@ -130,7 +131,8 @@ func obtainCertificate(email string, inp Input) (*certOutput, error) {
return nil, fmt.Errorf("can't obtain lets encrypt registration for %s: %w", email, err)
}

out, err := client.Certificate.Obtain(certificate.ObtainRequest{Domains: inp.Domain})
domainList := strings.Split(inp.Domain, ",")
out, err := client.Certificate.Obtain(certificate.ObtainRequest{Domains: domainList})
if err != nil {
return nil, fmt.Errorf("can't obtain certificates for domain %v: %w", inp.Domain, err)
}
Expand Down
4 changes: 2 additions & 2 deletions go/letsencrypt/internal/producer/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ type CreateRequest struct {
// Input includes variables specific to Let's Encrypt producer. The input
// should be provided with `get-dynamic-secret-value` operation.
type Input struct {
UseStaging bool `json:"use_staging"`
Domain []string `json:"domain"`
UseStaging bool `json:"use_staging"`
Domain string `json:"domain"`
}

// UnmarshalJSON implements json.Unmarshaler.
Expand Down

0 comments on commit b97ced1

Please sign in to comment.