add optional config setting to use nats standard tcp instead of websockets

This commit is contained in:
wh1te909 2022-07-01 19:12:34 +00:00
parent 38907f6bc2
commit 92dd7c110f
4 changed files with 44 additions and 34 deletions

View file

@ -151,7 +151,13 @@ func New(logger *logrus.Logger, version string) *Agent {
natsProxyPort = "443"
}
natsServer := fmt.Sprintf("wss://%s:%s", ac.APIURL, natsProxyPort)
// check if using nats standard tcp, otherwise use nats websockets by default
var natsServer string
if ac.NatsStandardPort != "" {
natsServer = fmt.Sprintf("tls://%s:%s", ac.APIURL, ac.NatsStandardPort)
} else {
natsServer = fmt.Sprintf("wss://%s:%s", ac.APIURL, natsProxyPort)
}
return &Agent{
Hostname: info.Hostname,