mirror of
https://github.com/lorsanstand/HomeOps-Hub.git
synced 2026-06-19 20:05:17 +03:00
feat: update conn in hub
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/rs/zerolog"
|
||||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
|
||||
@@ -13,6 +14,7 @@ type AgentConfig struct {
|
||||
Host string `yaml:"host"`
|
||||
Port int `yaml:"port"`
|
||||
} `yaml:"hub"`
|
||||
LogLevel string `yaml:"log_level"`
|
||||
}
|
||||
|
||||
func NewConfig() (*AgentConfig, error) {
|
||||
@@ -29,3 +31,19 @@ func NewConfig() (*AgentConfig, error) {
|
||||
|
||||
return &cfg, nil
|
||||
}
|
||||
|
||||
func (c *AgentConfig) GetLogLevel() zerolog.Level {
|
||||
level, err := zerolog.ParseLevel(c.LogLevel)
|
||||
if err != nil {
|
||||
return zerolog.InfoLevel
|
||||
}
|
||||
return level
|
||||
}
|
||||
|
||||
func (c *AgentConfig) GetMode() string {
|
||||
return "PROD"
|
||||
}
|
||||
|
||||
func (c *AgentConfig) GetGRPCAddress() string {
|
||||
return fmt.Sprintf("%v:%v", c.HubConnect.Host, c.HubConnect.Port)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user