update: make things work with the new package system
This commit is contained in:
33
lib/config.go
Normal file
33
lib/config.go
Normal file
@ -0,0 +1,33 @@
|
||||
package lib
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"os"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
Pools []Pool `json:"pools"`
|
||||
}
|
||||
|
||||
func (c *Config) Load(list *[]Package, file string) error {
|
||||
var (
|
||||
content []byte
|
||||
err error
|
||||
)
|
||||
|
||||
if content, err = os.ReadFile(file); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
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
|
||||
}
|
Reference in New Issue
Block a user