Refactor and doc

This commit is contained in:
ycc
2024-09-04 10:53:12 +02:00
parent fba1608edb
commit bb36ac0fb4
9 changed files with 161 additions and 45 deletions

View File

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