You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
594 B
48 lines
594 B
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 |
|
}
|
|
|