go-common/app/common/openplatform/geetest/conf/conf.go
2019-04-22 18:49:16 +08:00

49 lines
594 B
Go

package conf
import (
"encoding/json"
"io/ioutil"
)
// Conf info.
var (
Conf *Config
)
// Config struct.
type Config struct {
// httpClinet
HTTPClient *HTTPClient
// host
Host *Host
// Secret
Secret *Secret
}
// HTTPClient conf.
type HTTPClient struct {
Dial int64
KeepAlive int64
}
// Host conf.
type Host struct {
Geetest string
}
// Secret of Geetest
type Secret struct {
CaptchaID string
PrivateKey string
}
// Init conf.
func Init() (err error) {
bs, err := ioutil.ReadFile("config.json")
if err != nil {
return
}
err = json.Unmarshal(bs, &Conf)
return
}