Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable SSL/TLS communication through -ssl flag #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions influx-cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ var asyncInserts chan *client.Series
var asyncInsertsCommitted chan int
var forceInsertsFlush chan bool
var sync_inserts_timer metrics.Timer
var ssl bool

var path_rc, path_hist string

Expand Down Expand Up @@ -123,6 +124,7 @@ type Config struct {
User string
Pass string
Db string
Ssl bool
AsyncCapacity int
AsyncMaxWait int
}
Expand All @@ -138,6 +140,7 @@ func init() {
flag.StringVar(&db, "db", "", "database to use")
flag.BoolVar(&recordsOnly, "recordsOnly", false, "when enabled, doesn't display header")
flag.BoolVar(&async, "async", false, "when enabled, asynchronously flushes inserts")
flag.BoolVar(&ssl, "ssl", false, "when enabled, uses SSL/TLS for communication")

flag.Usage = func() {
fmt.Fprintln(os.Stderr, "Usage: influx-cli [flags] [query to execute on start]")
Expand Down Expand Up @@ -261,6 +264,7 @@ func getClient() error {
Username: user,
Password: pass,
Database: db,
IsSecure: ssl,
}
var err error
cl, err = client.NewClient(cfg)
Expand Down Expand Up @@ -316,6 +320,9 @@ func main() {
if conf.Db != "" {
db = conf.Db
}
if conf.Ssl != false {
ssl = conf.Ssl
}
if conf.AsyncCapacity > 0 {
AsyncCapacity = conf.AsyncCapacity
}
Expand Down