refactor: isolate RootPathWarningMessage

This commit is contained in:
Fernandez Ludovic 2026-03-10 00:21:26 +01:00
commit 0fabf2bda4
3 changed files with 13 additions and 13 deletions

View file

@ -19,17 +19,6 @@ import (
"github.com/urfave/cli/v3"
)
const rootPathWarningMessage = `!!!! HEADS UP !!!!
Your account credentials have been saved in your
configuration directory at "%s".
You should make a secure backup of this folder now. This
configuration directory will also contain private keys
generated by lego and certificates obtained from the ACME
server. Making regular backups of this folder is ideal.
`
func createRegister() *cli.Command {
return &cli.Command{
Name: "register",
@ -71,7 +60,7 @@ func register(ctx context.Context, cmd *cli.Command) error {
return fmt.Errorf("could not save the account file: %w", err)
}
fmt.Printf(rootPathWarningMessage, accountsStorage.GetRootPath())
fmt.Printf(storage.RootPathWarningMessage, accountsStorage.GetRootPath())
} else {
log.Info("Account already registered, skipping.")
}

View file

@ -62,7 +62,7 @@ func run(ctx context.Context, cmd *cli.Command) error {
return fmt.Errorf("could not save the account file: %w", err)
}
fmt.Printf(rootPathWarningMessage, accountsStorage.GetRootPath())
fmt.Printf(storage.RootPathWarningMessage, accountsStorage.GetRootPath())
}
setupChallenges(cmd, client)

View file

@ -19,6 +19,17 @@ import (
"github.com/go-acme/lego/v5/log"
)
const RootPathWarningMessage = `!!!! HEADS UP !!!!
Your account credentials have been saved in your
configuration directory at "%s".
You should make a secure backup of this folder now. This
configuration directory will also contain private keys
generated by lego and certificates obtained from the ACME
server. Making regular backups of this folder is ideal.
`
const (
baseAccountsRootFolderName = "accounts"
accountFileName = "account.json"