Skip to content

Commit

Permalink
Rename getEmail -> setEmail
Browse files Browse the repository at this point in the history
It doesn't really return the email address; it mutates the ACMEIssuer.
  • Loading branch information
mholt committed Jul 5, 2022
1 parent d08f6e1 commit 9b9f842
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions account.go
Expand Up @@ -171,14 +171,14 @@ func (am *ACMEIssuer) saveAccount(ctx context.Context, ca string, account acme.A
return storeTx(ctx, am.config.Storage, all)
}

// getEmail does everything it can to obtain an email address
// setEmail does everything it can to obtain an email address
// from the user within the scope of memory and storage to use
// for ACME TLS. If it cannot get an email address, it does nothing
// (If user is prompted, it will warn the user of
// the consequences of an empty email.) This function MAY prompt
// the user for input. If allowPrompts is false, the user
// will NOT be prompted and an empty email may be returned.
func (am *ACMEIssuer) getEmail(ctx context.Context, allowPrompts bool) error {
func (am *ACMEIssuer) setEmail(ctx context.Context, allowPrompts bool) error {
leEmail := am.Email

// First try package default email, or a discovered email address
Expand Down
6 changes: 3 additions & 3 deletions account_test.go
Expand Up @@ -171,7 +171,7 @@ func TestGetEmailFromPackageDefault(t *testing.T) {
}
am.config = testConfig

err := am.getEmail(ctx, true)
err := am.setEmail(ctx, true)
if err != nil {
t.Fatalf("getEmail error: %v", err)
}
Expand Down Expand Up @@ -203,7 +203,7 @@ func TestGetEmailFromUserInput(t *testing.T) {

email := "test3@foo.com"
stdin = bytes.NewBufferString(email + "\n")
err := am.getEmail(ctx, true)
err := am.setEmail(ctx, true)
if err != nil {
t.Fatalf("getEmail error: %v", err)
}
Expand Down Expand Up @@ -263,7 +263,7 @@ func TestGetEmailFromRecent(t *testing.T) {
t.Fatalf("Could not change user folder mod time for '%s': %v", eml, err)
}
}
err := am.getEmail(ctx, true)
err := am.setEmail(ctx, true)
if err != nil {
t.Fatalf("getEmail error: %v", err)
}
Expand Down
2 changes: 1 addition & 1 deletion acmeissuer.go
Expand Up @@ -226,7 +226,7 @@ func (am *ACMEIssuer) PreCheck(ctx context.Context, names []string, interactive
}
}
}
return am.getEmail(ctx, interactive)
return am.setEmail(ctx, interactive)
}

// Issue implements the Issuer interface. It obtains a certificate for the given csr using
Expand Down

0 comments on commit 9b9f842

Please sign in to comment.