package config import ( "log" "os" toml "github.com/pelletier/go-toml/v2" ) type Provider struct { Url string Throttle int Range string After_date string Cmd string Cookies bool Cookies_file string Opml_file string } type Config struct { Out_dir string Provider map[string]Provider Dry_run bool } func Load(filepath string) (Config, error) { data, err := os.ReadFile(filepath) if err != nil { panic(err) } cfg := Config{} err = toml.Unmarshal(data, &cfg) if err != nil { panic(err) } log.Printf("Loaded config:") log.Printf("%+v\n", cfg) return cfg, err }