nats_output: use the configured credentials file (#8986)

This commit is contained in:
Rene Kaufmann 2021-03-15 17:09:10 +01:00 committed by GitHub
parent 38c61c07ef
commit 4e9bc06eb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -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))
}