CLI: renew only the first domain (CommonName)

This commit is contained in:
xenolf 2015-12-15 21:10:47 +01:00
parent 102a9f756b
commit 2d385d3f41

View file

@ -173,7 +173,12 @@ func revoke(c *cli.Context) {
func renew(c *cli.Context) {
conf, _, client := setup(c)
for _, domain := range c.GlobalStringSlice("domains") {
if len(c.GlobalStringSlice("domains")) <= 0 {
logger().Fatal("Please specify at least one domain.")
}
domain := c.GlobalStringSlice("domains")[0]
// load the cert resource from files.
// We store the certificate, private key and metadata in different files
// as web servers would not be able to work with a combined file.
@ -192,8 +197,8 @@ func renew(c *cli.Context) {
logger().Printf("Could not get Certification expiration for domain %s", domain)
}
if int(expTime.Sub(time.Now()).Hours()/24.0) <= c.Int("days") {
continue
if int(expTime.Sub(time.Now()).Hours() / 24.0) <= c.Int("days") {
return
}
}
@ -222,5 +227,4 @@ func renew(c *cli.Context) {
}
saveCertRes(newCert, conf)
}
}