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

Influxdb: add insecure option #16025

Merged
merged 4 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions api/globalconfig/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ type Influx struct {
Org string `json:"org"`
User string `json:"user"`
Password string `json:"password"`
Insecure bool `json:"insecure"`
}

// Redacted implements the redactor interface used by the tee publisher
Expand Down
1 change: 1 addition & 0 deletions cmd/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,7 @@ func configureInflux(conf *globalconfig.Influx) (*server.Influx, error) {
conf.User,
conf.Password,
conf.Database,
conf.Insecure,
)

return influx, nil
Expand Down
10 changes: 8 additions & 2 deletions server/influxdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,21 @@ type Influx struct {
}

// NewInfluxClient creates new publisher for influx
func NewInfluxClient(url, token, org, user, password, database string) *Influx {
func NewInfluxClient(url, token, org, user, password, database string, insecure bool) *Influx {
log := util.NewLogger("influx")

// InfluxDB v1 compatibility
if token == "" && user != "" {
token = fmt.Sprintf("%s:%s", user, password)
}

options := influxdb2.DefaultOptions().SetPrecision(time.Second)
options := influxdb2.DefaultOptions()

tlsConfig := options.TLSConfig()
tlsConfig.InsecureSkipVerify = true
andig marked this conversation as resolved.
Show resolved Hide resolved
options.SetTLSConfig(tlsConfig)
options.SetPrecision(time.Second)

client := influxdb2.NewClientWithOptions(url, token, options)

// handle error logging in writer
Expand Down