refactor: 参数优化
- 增加MQTT_UP参数,不需要订阅数据时,关闭
正在显示
4 个修改的文件
包含
8 行增加
和
1 行删除
@@ -29,8 +29,9 @@ func main() { | @@ -29,8 +29,9 @@ func main() { | ||
29 | redis.InitRedis() | 29 | redis.InitRedis() |
30 | log.Logger.Info("server start ....") | 30 | log.Logger.Info("server start ....") |
31 | log.Logger.Debug(fmt.Sprintf("ENABLE_KAFKA_LOG:%v", constant.ENABLE_KAFKA_LOG)) | 31 | log.Logger.Debug(fmt.Sprintf("ENABLE_KAFKA_LOG:%v", constant.ENABLE_KAFKA_LOG)) |
32 | - | 32 | + if constant.MQTT_UP { |
33 | go mqtt.Start(log.Logger) | 33 | go mqtt.Start(log.Logger) |
34 | + } | ||
34 | go task.Run() | 35 | go task.Run() |
35 | cron := crontab.NewCrontabService(nil) | 36 | cron := crontab.NewCrontabService(nil) |
36 | cron.StartCrontabTask() | 37 | cron.StartCrontabTask() |
@@ -28,10 +28,12 @@ var MQTT_HOST = "47.97.5.102" | @@ -28,10 +28,12 @@ var MQTT_HOST = "47.97.5.102" | ||
28 | var MQTT_PORT = "6000" | 28 | var MQTT_PORT = "6000" |
29 | var MQTT_USER = "admin" | 29 | var MQTT_USER = "admin" |
30 | var MQTT_PASSWORD = "123456" | 30 | var MQTT_PASSWORD = "123456" |
31 | +var MQTT_UP = true | ||
31 | 32 | ||
32 | func init() { | 33 | func init() { |
33 | MQTT_HOST = Configurator.DefaultString("MQTT_HOST", MQTT_HOST) | 34 | MQTT_HOST = Configurator.DefaultString("MQTT_HOST", MQTT_HOST) |
34 | MQTT_PORT = Configurator.DefaultString("MQTT_PORT", MQTT_PORT) | 35 | MQTT_PORT = Configurator.DefaultString("MQTT_PORT", MQTT_PORT) |
35 | MQTT_USER = Configurator.DefaultString("MQTT_USER", MQTT_USER) | 36 | MQTT_USER = Configurator.DefaultString("MQTT_USER", MQTT_USER) |
36 | MQTT_PASSWORD = Configurator.DefaultString("MQTT_PASSWORD", MQTT_PASSWORD) | 37 | MQTT_PASSWORD = Configurator.DefaultString("MQTT_PASSWORD", MQTT_PASSWORD) |
38 | + MQTT_UP = Configurator.DefaultBool("MQTT_UP", MQTT_UP) | ||
37 | } | 39 | } |
-
请 注册 或 登录 后发表评论