config.go 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. package conf
  2. import (
  3. beego "github.com/beego/beego/v2/server/web"
  4. )
  5. func init() {
  6. //configFilePath, err := filepath.Abs("app.conf")
  7. //if err != nil {
  8. // logs.Println("configFilePathError", err)
  9. //}
  10. //logs.Println("configFilePath:",configFilePath)
  11. //err = beego.LoadAppConfig("ini", configFilePath)
  12. //if err != nil {
  13. // logs.Println("loadConfigFileError", err)
  14. //}
  15. }
  16. var HTTPPort, _ = beego.AppConfig.Int("HTTPPort")
  17. var AppName, _ = beego.AppConfig.String("appname")
  18. // Redis
  19. var Redis_address, _ = beego.AppConfig.String("Redis_address")
  20. var Redis_password, _ = beego.AppConfig.String("Redis_password")
  21. var Redis_dbNum, _ = beego.AppConfig.String("Redis_dbNum")
  22. // Mysql
  23. var MysqlServer_UrlPort, _ = beego.AppConfig.String("MysqlServer_UrlPort")
  24. var MysqlServer_Database, _ = beego.AppConfig.String("MysqlServer_Database")
  25. var MysqlServer_Username, _ = beego.AppConfig.String("MysqlServer_Username")
  26. var MysqlServer_Password, _ = beego.AppConfig.String("MysqlServer_Password")
  27. var MysqlServer_MaxIdleConnections, _ = beego.AppConfig.Int("MysqlServer_MaxIdleConnections")
  28. var MysqlServer_MaxOpenConnections, _ = beego.AppConfig.Int("MysqlServer_MaxOpenConnections")
  29. // Mqtt
  30. var MqttServer_Open, _ = beego.AppConfig.Int("MqttServer_Open")
  31. var MqttServer_Url, _ = beego.AppConfig.String("MqttServer_Url")
  32. var MqttServer_Username, _ = beego.AppConfig.String("MqttServer_Username")
  33. var MqttServer_Password, _ = beego.AppConfig.String("MqttServer_Password")
  34. var MqttServer_ClientID, _ = beego.AppConfig.String("MqttServer_ClientID")
  35. // Mqtt
  36. var TCPServer_Open, _ = beego.AppConfig.Int("TCPServer_Open")
  37. var TCPServer_Port, _ = beego.AppConfig.Int("TCPServer_Port")
  38. // HTTPServer_Open
  39. var HTTPServer_Open, _ = beego.AppConfig.Int("HTTPServer_Open")
  40. var HTTPServer_Port, _ = beego.AppConfig.Int("HTTPServer_Port")
  41. // Mongodb
  42. var Mongodb_Url, _ = beego.AppConfig.String("Mongodb_Url")
  43. var Mongodb_DB, _ = beego.AppConfig.String("Mongodb_DB")
  44. var Mongodb_Username, _ = beego.AppConfig.String("Mongodb_Username")
  45. var Mongodb_Password, _ = beego.AppConfig.String("Mongodb_Password")
  46. // 数据解析加载目录
  47. var Analysis_Dir, _ = beego.AppConfig.String("Analysis_Dir")
  48. // Nats
  49. var NatsServer_Url, _ = beego.AppConfig.String("NatsServer_Url")
  50. // Qiniu
  51. var Qiniu_AccessKey, _ = beego.AppConfig.String("Qiniu_AccessKey")
  52. var Qiniu_SecretKey, _ = beego.AppConfig.String("Qiniu_SecretKey")
  53. var Qiniu_BUCKET, _ = beego.AppConfig.String("Qiniu_BUCKET")
  54. var Qiniu_Dir, _ = beego.AppConfig.String("Qiniu_Dir")
  55. var Qiniu_Url, _ = beego.AppConfig.String("Qiniu_Url")