add update interval option

This commit is contained in:
ngn
2024-11-22 16:56:02 +03:00
parent 6810f9b2ec
commit f9e9ef2dd1
5 changed files with 45 additions and 32 deletions

View File

@ -6,7 +6,8 @@ import (
)
type Config struct {
Pools []Pool `json:"pools"`
Interval int `json:"interval"`
Pools []Pool `json:"pools"`
}
func (c *Config) Load(list *[]Package, file string) error {
@ -19,15 +20,13 @@ func (c *Config) Load(list *[]Package, file string) error {
return err
}
// default config values
c.Interval = 5
c.Pools = []Pool{}
if err = json.Unmarshal(content, c); err != nil {
return err
}
for _, p := range c.Pools {
if err = p.Load(list); err != nil {
return err
}
}
return nil
}