PixivFE/configs/config.go

30 lines
409 B
Go
Raw Normal View History

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"`
userAgent int `yaml:"userAgent"`
}
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)
}
}