示例#1
0
文件: yandex.go 项目: shizeeg/jagod
func init() {
	cfg, err := ini.Load("/etc/yandex.cfg")
	if err != nil {
		log.Println(err)
	}

	flag.StringVar(&lang, "lang", cfg.Section("").Key("LANG").In("ru", []string{}), "Localization")
	flag.StringVar(&apikey, "apikey", cfg.Section("").Key("APIKEY").String(), "Yandex Dict.API Key")
	flag.Parse()
}
示例#2
0
文件: config.go 项目: shizeeg/jagod
// ReadFile reads config from filename
// cfg := Config{}
// if err := cfg.ReadFile("my.conf"); err != nil {
//	log.Fataln(err)
// }
func (cfg *Config) ReadFile(filename string) error {
	c, err := ini.Load(filename)
	if err != nil {
		return err
	}
	cfg.c = c
	acc := cfg.c.Section("account")
	cfg.xmppConfig = &xmpp.Config{}
	cfg.xmppConfig.Resource = acc.Key("resource").String()
	cfg.xmppConfig.SkipTLS = acc.Key("SkipTLS").MustBool()
	cfg.xmppConfig.TrustedAddress = acc.Key("trusted").MustBool()
	cfg.xmppConfig.ServerCertificateSHA256 = FingerprintToBytes(acc.Key("FingerprintSHA256").String())
	return nil
}