Merge pull request #3177 from jipperinbham/command-line-https-support

add ssl flag to convert scheme to https
pull/3186/head
Philip O'Toole 2015-06-29 14:01:37 -04:00
commit bd3284f491
1 changed files with 7 additions and 0 deletions

View File

@ -38,6 +38,7 @@ type CommandLine struct {
Username string
Password string
Database string
Ssl bool
RetentionPolicy string
Version string
Pretty bool // controls pretty print for json
@ -56,6 +57,7 @@ func main() {
fs.StringVar(&c.Username, "username", c.Username, "username to connect to the server.")
fs.StringVar(&c.Password, "password", c.Password, `password to connect to the server. Leaving blank will prompt for password (--password="")`)
fs.StringVar(&c.Database, "database", c.Database, "database to connect to the server.")
fs.BoolVar(&c.Ssl, "ssl", false, "use https for connecting to cluster")
fs.StringVar(&c.Format, "format", default_format, "format specifies the format of the server responses: json, csv, or column")
fs.BoolVar(&c.Pretty, "pretty", false, "turns on pretty print for the json format")
fs.BoolVar(&c.ShouldDump, "dump", false, "dump the contents of the given database to stdout")
@ -77,6 +79,8 @@ func main() {
Password to connect to the server. Leaving blank will prompt for password (--password '')
-username 'username'
Username to connect to the server.
-ssl
Use https for requests.
-dump
Dump the contents of the given database to stdout.
-execute 'command'
@ -254,6 +258,9 @@ func (c *CommandLine) connect(cmd string) {
u := url.URL{
Scheme: "http",
}
if c.Ssl {
u.Scheme = "https"
}
if c.Port > 0 {
u.Host = fmt.Sprintf("%s:%d", c.Host, c.Port)
} else {