From 4e9bc06eb2da52622c26583f5c26f7f9c72b38d1 Mon Sep 17 00:00:00 2001 From: Rene Kaufmann Date: Mon, 15 Mar 2021 17:09:10 +0100 Subject: [PATCH] nats_output: use the configured credentials file (#8986) --- plugins/outputs/nats/nats.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/outputs/nats/nats.go b/plugins/outputs/nats/nats.go index 50102b43a47dd..f4cf35b16e4f7 100644 --- a/plugins/outputs/nats/nats.go +++ b/plugins/outputs/nats/nats.go @@ -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)) }