From 0f32c176d72684b8e9bd01b81c938cc0d97fa79c Mon Sep 17 00:00:00 2001 From: xenolf Date: Sat, 26 Sep 2015 20:00:19 +0200 Subject: [PATCH] Remove CA path from config dir. --- cli.go | 10 +------- cli_handlers.go | 62 +++++++++++++++++++++++------------------------- configuration.go | 2 +- 3 files changed, 32 insertions(+), 42 deletions(-) diff --git a/cli.go b/cli.go index 18a0a2dd..d5ef2fe3 100644 --- a/cli.go +++ b/cli.go @@ -24,7 +24,7 @@ func main() { app := cli.NewApp() app.Name = "lego" app.Usage = "Let's encrypt client to go!" - app.Version = "0.0.1" + app.Version = "0.0.2" cwd, err := os.Getwd() if err != nil { @@ -103,14 +103,6 @@ func main() { Value: 2048, Usage: "Size of the RSA key.", }, - cli.BoolFlag{ - Name: "no-confirm", - Usage: "Turn off confirmation screens.", - }, - cli.BoolFlag{ - Name: "agree-tos, e", - Usage: "Skip the end user license agreement screen.", - }, cli.StringFlag{ Name: "path", Usage: "Directory to use for storing the data", diff --git a/cli_handlers.go b/cli_handlers.go index 718cfc79..72204359 100644 --- a/cli_handlers.go +++ b/cli_handlers.go @@ -44,44 +44,42 @@ func run(c *cli.Context) { logger().Print("!!!! HEADS UP !!!!") logger().Printf(` - Your account credentials have been saved in your Let's Encrypt - configuration directory at "%s". - You should make a secure backup of this folder now. This - configuration directory will also contain certificates and - private keys obtained from Let's Encrypt so making regular - backups of this folder is ideal.`, c.GlobalString("config-dir")) + Your account credentials have been saved in your Let's Encrypt + configuration directory at "%s". + You should make a secure backup of this folder now. This + configuration directory will also contain certificates and + private keys obtained from Let's Encrypt so making regular + backups of this folder is ideal.`, conf.AccountPath(c.GlobalString("email"))) } if acc.Registration.Body.Agreement == "" { - if !c.GlobalBool("agree-tos") { - reader := bufio.NewReader(os.Stdin) - logger().Printf("Please review the TOS at %s", acc.Registration.TosURL) + reader := bufio.NewReader(os.Stdin) + logger().Printf("Please review the TOS at %s", acc.Registration.TosURL) - for { - logger().Println("Do you accept the TOS? Y/n") - text, err := reader.ReadString('\n') - if err != nil { - logger().Fatalf("Could not read from console -> %v", err) - } - - text = strings.Trim(text, "\r\n") - - if text == "n" { - logger().Fatal("You did not accept the TOS. Unable to proceed.") - } - - if text == "Y" || text == "y" || text == "" { - err = client.AgreeToTos() - if err != nil { - logger().Fatalf("Could not agree to tos -> %v", err) - } - acc.Save() - break - } - - logger().Println("Your input was invalid. Please answer with one of Y/y, n or by pressing enter.") + for { + logger().Println("Do you accept the TOS? Y/n") + text, err := reader.ReadString('\n') + if err != nil { + logger().Fatalf("Could not read from console -> %v", err) } + + text = strings.Trim(text, "\r\n") + + if text == "n" { + logger().Fatal("You did not accept the TOS. Unable to proceed.") + } + + if text == "Y" || text == "y" || text == "" { + err = client.AgreeToTos() + if err != nil { + logger().Fatalf("Could not agree to tos -> %v", err) + } + acc.Save() + break + } + + logger().Println("Your input was invalid. Please answer with one of Y/y, n or by pressing enter.") } } diff --git a/configuration.go b/configuration.go index 0bd27f3b..e96896aa 100644 --- a/configuration.go +++ b/configuration.go @@ -31,7 +31,7 @@ func (c *Configuration) OptPort() string { // ServerPath returns the OS dependent path to the data for a specific CA func (c *Configuration) ServerPath() string { srv, _ := url.Parse(c.context.GlobalString("server")) - srvStr := strings.Replace(srv.Host, ":", "_", -1) + srv.Path + srvStr := strings.Replace(srv.Host, ":", "_", -1) return strings.Replace(srvStr, "/", string(os.PathSeparator), -1) }