Warehouse nats #13

Merged
trunglt251292 merged 7 commits from warehouse-nats into develop 2022-08-30 07:47:52 +00:00
1 changed files with 3 additions and 0 deletions
Showing only changes of commit 1e3bfd7392 - Show all commits

View File

@ -3,6 +3,7 @@ package natsio
import (
"errors"
"fmt"
"time"
"github.com/logrusorgru/aurora"
"github.com/nats-io/nats.go"
@ -32,6 +33,8 @@ func Connect(cfg Config) error {
// Connect options
opts := make([]nats.Option, 0)
opts = append(opts, nats.Timeout(1*time.Minute))
// Has authentication
if cfg.User != "" {
opts = append(opts, nats.UserInfo(cfg.User, cfg.Password))