Conf.go 641 B

1234567891011121314151617181920212223242526272829303132333435
  1. package cloudserver
  2. import (
  3. "crypto/md5"
  4. "encoding/hex"
  5. )
  6. type CloudServerConf struct {
  7. ServerUrl string
  8. AppId string
  9. AppSecret string
  10. Route string
  11. }
  12. var defConf = &CloudServerConf{
  13. AppId: "fvWmjGCU",
  14. AppSecret: "054e7df0881eff8328858092f9e8ac0b0f356676",
  15. ServerUrl: "https://test-admin.pacom.cn",
  16. Route: "gw4g-cloudserver",
  17. }
  18. func (c *CloudServerConf) GenerateSignature() string {
  19. res := md5V(c.AppId + "-pacom-" + c.AppSecret)
  20. return res
  21. }
  22. func md5V(str string) string {
  23. h := md5.New()
  24. h.Write([]byte(str))
  25. return hex.EncodeToString(h.Sum(nil))
  26. }
  27. func GetCloudConfig() interface{} {
  28. return defConf
  29. }