CLI: Give helpful error message if --http/--tls is given without colon

Fixes #134
This commit is contained in:
Michael Cross 2016-02-19 21:11:41 +00:00
parent d17982745f
commit c3abd54dc7

View file

@ -44,10 +44,16 @@ func setup(c *cli.Context) (*Configuration, *Account, *acme.Client) {
} }
if c.GlobalIsSet("http") { if c.GlobalIsSet("http") {
if strings.Index(c.GlobalString("http"), ":") == -1 {
logger().Fatalf("The --http switch only accepts interface:port or :port for its argument.")
}
client.SetHTTPAddress(c.GlobalString("http")) client.SetHTTPAddress(c.GlobalString("http"))
} }
if c.GlobalIsSet("tls") { if c.GlobalIsSet("tls") {
if strings.Index(c.GlobalString("tls"), ":") == -1 {
logger().Fatalf("The --tls switch only accepts interface:port or :port for its argument.")
}
client.SetTLSAddress(c.GlobalString("tls")) client.SetTLSAddress(c.GlobalString("tls"))
} }