2023-05-18 13:18:44 +00:00
|
|
|
package configs
|
|
|
|
|
|
|
|
import (
|
|
|
|
"embed"
|
|
|
|
"gopkg.in/yaml.v3"
|
|
|
|
"os"
|
|
|
|
)
|
|
|
|
|
|
|
|
var Config embed.FS
|
|
|
|
var Configs Conf
|
|
|
|
|
|
|
|
type Conf struct {
|
|
|
|
PHPSESSID string `yaml:"PHPSESSID"`
|
2023-05-20 04:16:25 +00:00
|
|
|
UserAgent string `yaml:"UserAgent"`
|
|
|
|
PageItems int `yaml:"PageItems"`
|
2023-05-18 13:18:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (conf *Conf) ReadConfig() {
|
|
|
|
f, err := os.Open("config.yml")
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
defer f.Close()
|
|
|
|
|
|
|
|
decoder := yaml.NewDecoder(f)
|
|
|
|
err = decoder.Decode(conf)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
}
|