address format and deps change + logger option

This commit is contained in:
nquidox 2026-04-03 11:46:29 +03:00
parent f70d53c75c
commit 5fe38af035
2 changed files with 35 additions and 28 deletions

View file

@ -2,8 +2,6 @@ package processor
import (
"context"
"fmt"
"net"
"task-processor/internal/taskAgent"
)
@ -15,28 +13,22 @@ type handler struct {
type Addr struct {
Host string
Port string
Port uint16
User string
Pass string
Vhost string
}
type Deps struct {
Ctx context.Context
TA taskAgent.TaskAgent
Addr Addr
ChanLen uint
Ctx context.Context
TA taskAgent.TaskAgent
Addr Addr
ChanLen uint
LoggerEnabled bool
}
func NewHandler(deps Deps) Processor {
addr := makeAddr(deps.Addr)
return &handler{
service: newService(deps, addr),
service: newService(deps),
}
}
func makeAddr(addr Addr) string {
//"amqp://username:password@host:port/vhost"
return fmt.Sprintf("amqp://%v:%v@%v/%v", addr.User, addr.Pass, net.JoinHostPort(addr.Host, addr.Port), addr.Vhost)
}