feat: update conn in hub

This commit is contained in:
2026-04-05 15:48:23 +03:00
parent acbc100928
commit 306dcff31f
8 changed files with 100 additions and 73 deletions
+38
View File
@@ -0,0 +1,38 @@
package app
import (
standartlog "log"
"github.com/lorsanstand/HomeOps-Hub/internal/agent/rpc"
"github.com/lorsanstand/HomeOps-Hub/internal/agent/utils/config_yaml"
log2 "github.com/lorsanstand/HomeOps-Hub/internal/shared/log"
"github.com/rs/zerolog"
)
type App struct {
log zerolog.Logger
cfg *config_yaml.AgentConfig
hubConn *rpc.Connection
}
func NewApp() *App {
cfg, err := config_yaml.NewConfig()
if err != nil {
standartlog.Fatalf("failed get config: %v", err)
}
log := log2.NewLogger(cfg)
return &App{cfg: cfg, log: log}
}
func (a *App) Run() {
conn, err := rpc.NewConnectAgent(a.cfg.GetGRPCAddress())
if err != nil {
a.log.Error().Err(err)
return
}
a.hubConn = conn
r
}