1
0
mirror of https://github.com/go-acme/lego.git synced 2025-01-05 08:02:30 +02:00

return empty string if no-email is set

Signed-off-by: schou <pschou@users.noreply.github.com>
This commit is contained in:
schou 2023-12-06 07:59:56 -05:00
parent 504497e345
commit 51ef22a6c2

View File

@ -58,6 +58,7 @@ const (
// │ └── root accounts directory
// └── "path" option
type AccountsStorage struct {
noEmail bool
userID string
rootPath string
rootUserPath string
@ -69,7 +70,8 @@ type AccountsStorage struct {
// NewAccountsStorage Creates a new AccountsStorage.
func NewAccountsStorage(ctx *cli.Context) *AccountsStorage {
var userID string
if ctx.IsSet("no-email") {
noEmail := ctx.IsSet("no-email")
if noEmail {
userID = "default"
} else {
// TODO: move to account struct?
@ -87,6 +89,7 @@ func NewAccountsStorage(ctx *cli.Context) *AccountsStorage {
rootUserPath := filepath.Join(accountsPath, userID)
return &AccountsStorage{
noEmail: noEmail,
userID: userID,
rootPath: rootPath,
rootUserPath: rootUserPath,
@ -115,6 +118,9 @@ func (s *AccountsStorage) GetRootUserPath() string {
}
func (s *AccountsStorage) GetUserID() string {
if s.noEmail {
return ""
}
return s.userID
}