config.go 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /**
  2. ******************************************************************************
  3. * @file config.go
  4. * @author MakerYang
  5. ******************************************************************************
  6. */
  7. package Config
  8. import "time"
  9. var Get = &config{}
  10. type config struct {
  11. Service service `json:"service"`
  12. Database database `json:"database"`
  13. Hash hash `json:"hash"`
  14. }
  15. type service struct {
  16. Mode string `json:"mode"`
  17. HttpPort int `json:"http_port"`
  18. ReadTimeout time.Duration `json:"read_timeout"`
  19. WriteTimeout time.Duration `json:"write_timeout"`
  20. }
  21. type database struct {
  22. Type string `json:"type"`
  23. User string `json:"user"`
  24. Password string `json:"password"`
  25. Host string `json:"host"`
  26. Name string `json:"name"`
  27. }
  28. type hash struct {
  29. Salt string `json:"salt"`
  30. }
  31. func Init() {
  32. Get.Service.Mode = "debug"
  33. Get.Service.HttpPort = 7000
  34. Get.Service.ReadTimeout = 60 * time.Second
  35. Get.Service.WriteTimeout = 60 * time.Second
  36. Get.Database.Name = "database"
  37. Get.Database.Type = "mysql"
  38. Get.Database.Host = "localhost"
  39. Get.Database.User = "root"
  40. Get.Database.Password = "88888888"
  41. Get.Hash.Salt = "game_$@#godot_@$salt_$@$service%#^#%@%#"
  42. }