Skip to content

Commit

Permalink
nats_output: use the configured credentials file (influxdata#8986)
Browse files Browse the repository at this point in the history
  • Loading branch information
HeavyHorst authored Mar 15, 2021
1 parent 38c61c0 commit 4e9bc06
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion plugins/outputs/nats/nats.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,14 @@ func (n *NATS) Connect() error {
}

// override authentication, if any was specified
if n.Username != "" {
if n.Username != "" && n.Password != "" {
opts = append(opts, nats.UserInfo(n.Username, n.Password))
}

if n.Credentials != "" {
opts = append(opts, nats.UserCredentials(n.Credentials))
}

if n.Name != "" {
opts = append(opts, nats.Name(n.Name))
}
Expand Down

0 comments on commit 4e9bc06

Please sign in to comment.