Skip to content
This repository was archived by the owner on Sep 7, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions cert.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Default location of the config dir is
`,
}

certDisco = defaultDiscoFlag
certDisco discoAliasFlag
certAddr = "127.0.0.1:8080"
certExpiry = 365 * 12 * time.Hour
certBundle = true
Expand Down Expand Up @@ -97,6 +97,13 @@ func runCert(args []string) {
fatalf("no key found for %s", uc.URI)
}

useDisco := uc.CA
if string(certDisco) != "" {
useDisco = string(certDisco)
} else if useDisco == "" {
useDisco = string(defaultDiscoFlag)
}

// read or generate new cert key
certKey, err := anyKey(certKeypath, true)
if err != nil {
Expand All @@ -118,7 +125,7 @@ func runCert(args []string) {
// we only look for http-01 challenges at the moment
client := &acme.Client{
Key: uc.key,
DirectoryURL: string(certDisco),
DirectoryURL: useDisco,
}
for _, domain := range args {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Minute)
Expand Down
3 changes: 2 additions & 1 deletion reg.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ func runReg(args []string) {
}
uc := &userConfig{
Account: acme.Account{Contact: args},
CA: string(regDisco),
key: key,
}

Expand All @@ -79,7 +80,7 @@ func runReg(args []string) {
}
client := &acme.Client{
Key: uc.key,
DirectoryURL: string(regDisco),
DirectoryURL: uc.CA,
}

ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
Expand Down