From 71a5b5fc4b1e8a652f1bc8ca7c04eacaa289faf3 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sun, 18 Jun 2023 21:12:18 +0300 Subject: can specify my id --- internal/config/config.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'internal/config') diff --git a/internal/config/config.go b/internal/config/config.go index fe23cbc..e5cd224 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -15,7 +15,9 @@ type Config struct { StateDir string Address string Nodes []string - LoopIntervalS int64 `json:"LoopIntervalS,omitempty"` + LoopIntervalS int64 `json:"LoopIntervalS,omitempty"` + MyID string `json:"MyID,omitempty"` + RelaxedMode bool `json:"RelaxedMode,omitempty"` } func New(configFile string) (Config, error) { @@ -41,7 +43,13 @@ func New(configFile string) (Config, error) { c.LoopIntervalS = 10 } - log.Println("config: using loop interval of", c.LoopIntervalS) + if c.MyID == "" { + hostname, err := os.Hostname() + if err != nil { + return c, err + } + c.MyID = hostname + } return c, nil } -- cgit v1.2.3