Skip to content

Commit

Permalink
Merge pull request #3177 from jipperinbham/command-line-https-support
Browse files Browse the repository at this point in the history
add ssl flag to convert scheme to https
  • Loading branch information
otoolep committed Jun 29, 2015
2 parents 05d660a + 2372834 commit bd3284f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cmd/influx/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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")
Expand All @@ -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'
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit bd3284f

Please sign in to comment.