nats_output: use the configured credentials file (#8986)
This commit is contained in:
parent
38c61c07ef
commit
4e9bc06eb2
|
|
@ -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))
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue