diff options
| author | Paul Buetow <paul@buetow.org> | 2023-06-18 21:12:18 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2023-06-18 21:12:18 +0300 |
| commit | 71a5b5fc4b1e8a652f1bc8ca7c04eacaa289faf3 (patch) | |
| tree | 7b1a0d6b4fb01deec30536175df27d5dae1b5fd1 /internal/config | |
| parent | 831137abdecfcafeb21fb5f3de45156819f35ed4 (diff) | |
can specify my id
Diffstat (limited to 'internal/config')
| -rw-r--r-- | internal/config/config.go | 12 |
1 files changed, 10 insertions, 2 deletions
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 } |
