Refactor and doc
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"encoding/json"
|
||||
"strings"
|
||||
|
||||
"cloud.o-forge.io/core/oc-lib/config"
|
||||
"github.com/nats-io/nats.go"
|
||||
)
|
||||
|
||||
@@ -44,10 +45,10 @@ func NewNATSCaller() *natsCaller {
|
||||
|
||||
// SetNATSPub sets a message to the NATS server
|
||||
func (o *natsCaller) SetNATSPub(dataName string, method NATSMethod, data interface{}) string {
|
||||
if GetConfig().NATSUrl == "" {
|
||||
if config.GetConfig().NATSUrl == "" {
|
||||
return " -> NATS_SERVER is not set"
|
||||
}
|
||||
nc, err := nats.Connect(GetConfig().NATSUrl)
|
||||
nc, err := nats.Connect(config.GetConfig().NATSUrl)
|
||||
if err != nil {
|
||||
return " -> Could not reach NATS server : " + err.Error()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user