@@ -15,7 +15,7 @@ import (
1515 "github.com/go-acme/lego/v4/lego"
1616 "github.com/go-acme/lego/v4/log"
1717 "github.com/go-acme/lego/v4/registration"
18- "github.com/urfave/cli/v2 "
18+ "github.com/urfave/cli/v3 "
1919)
2020
2121const (
@@ -63,20 +63,20 @@ type AccountsStorage struct {
6363 rootUserPath string
6464 keysPath string
6565 accountFilePath string
66- ctx * cli.Context
66+ cmd * cli.Command
6767}
6868
6969// NewAccountsStorage Creates a new AccountsStorage.
70- func NewAccountsStorage (ctx * cli.Context ) * AccountsStorage {
70+ func NewAccountsStorage (cmd * cli.Command ) * AccountsStorage {
7171 // TODO: move to account struct? Currently MUST pass email.
72- email := getEmail (ctx )
72+ email := getEmail (cmd )
7373
74- serverURL , err := url .Parse (ctx .String (flgServer ))
74+ serverURL , err := url .Parse (cmd .String (flgServer ))
7575 if err != nil {
7676 log .Fatal (err )
7777 }
7878
79- rootPath := filepath .Join (ctx .String (flgPath ), baseAccountsRootFolderName )
79+ rootPath := filepath .Join (cmd .String (flgPath ), baseAccountsRootFolderName )
8080 serverPath := strings .NewReplacer (":" , "_" , "/" , string (os .PathSeparator )).Replace (serverURL .Host )
8181 accountsPath := filepath .Join (rootPath , serverPath )
8282 rootUserPath := filepath .Join (accountsPath , email )
@@ -87,7 +87,7 @@ func NewAccountsStorage(ctx *cli.Context) *AccountsStorage {
8787 rootUserPath : rootUserPath ,
8888 keysPath : filepath .Join (rootUserPath , baseKeysFolderName ),
8989 accountFilePath : filepath .Join (rootUserPath , accountFileName ),
90- ctx : ctx ,
90+ cmd : cmd ,
9191 }
9292}
9393
@@ -137,7 +137,7 @@ func (s *AccountsStorage) LoadAccount(privateKey crypto.PrivateKey) *Account {
137137 account .key = privateKey
138138
139139 if account .Registration == nil || account .Registration .Body .Status == "" {
140- reg , err := tryRecoverRegistration (s .ctx , privateKey )
140+ reg , err := tryRecoverRegistration (s .cmd , privateKey )
141141 if err != nil {
142142 log .Fatalf ("Could not load account for %s. Registration is nil: %#v" , s .userID , err )
143143 }
@@ -221,11 +221,11 @@ func loadPrivateKey(file string) (crypto.PrivateKey, error) {
221221 return nil , errors .New ("unknown private key type" )
222222}
223223
224- func tryRecoverRegistration (ctx * cli.Context , privateKey crypto.PrivateKey ) (* registration.Resource , error ) {
224+ func tryRecoverRegistration (cmd * cli.Command , privateKey crypto.PrivateKey ) (* registration.Resource , error ) {
225225 // couldn't load account but got a key. Try to look the account up.
226226 config := lego .NewConfig (& Account {key : privateKey })
227- config .CADirURL = ctx .String (flgServer )
228- config .UserAgent = getUserAgent (ctx )
227+ config .CADirURL = cmd .String (flgServer )
228+ config .UserAgent = getUserAgent (cmd )
229229
230230 client , err := lego .NewClient (config )
231231 if err != nil {
0 commit comments