package service import ( "github.com/BurntSushi/toml" ) type Config struct { WebAddr string `toml:"WebAddr"` WebIndex string `toml: "WebIndex"` REFRESH_TOKENS string `toml: "REFRESH_TOKENS"` PUSHPLUS_TOKEN string `toml: "PUSHPLUS_TOKEN"` EmailUser string `toml: "EmailUser"` EmailPwd string `toml: "EmailPwd"` EmailSmtp string `toml: "EmailSmtp"` EmailTls bool `toml: "EmailTls"` Username string `toml:"Username"` Password string `toml:"Password"` } var config *Config func LoadConfig(path string) *Config { conf := &Config{} _, err := toml.DecodeFile(path, conf) if err != nil { panic(err) } config = conf logger.Info(config) return config } // todo func saveConfig() { }