作者 yangfu

refactor: 参数优化

- 增加MQTT_UP参数,不需要订阅数据时,关闭
... ... @@ -125,4 +125,6 @@ spec:
- name: MQTT_HOST
value: "47.97.5.102"
- name: MQTT_PORT
value: "6000"
\ No newline at end of file
value: "6000"
- name: MQTT_UP
value: "false"
\ No newline at end of file
... ...
... ... @@ -125,4 +125,6 @@ spec:
- name: MQTT_HOST
value: "47.97.5.102"
- name: MQTT_PORT
value: "6000"
\ No newline at end of file
value: "6000"
- name: MQTT_UP
value: "false"
\ No newline at end of file
... ...
... ... @@ -29,8 +29,9 @@ func main() {
redis.InitRedis()
log.Logger.Info("server start ....")
log.Logger.Debug(fmt.Sprintf("ENABLE_KAFKA_LOG:%v", constant.ENABLE_KAFKA_LOG))
go mqtt.Start(log.Logger)
if constant.MQTT_UP {
go mqtt.Start(log.Logger)
}
go task.Run()
cron := crontab.NewCrontabService(nil)
cron.StartCrontabTask()
... ...
... ... @@ -28,10 +28,12 @@ var MQTT_HOST = "47.97.5.102"
var MQTT_PORT = "6000"
var MQTT_USER = "admin"
var MQTT_PASSWORD = "123456"
var MQTT_UP = true
func init() {
MQTT_HOST = Configurator.DefaultString("MQTT_HOST", MQTT_HOST)
MQTT_PORT = Configurator.DefaultString("MQTT_PORT", MQTT_PORT)
MQTT_USER = Configurator.DefaultString("MQTT_USER", MQTT_USER)
MQTT_PASSWORD = Configurator.DefaultString("MQTT_PASSWORD", MQTT_PASSWORD)
MQTT_UP = Configurator.DefaultBool("MQTT_UP", MQTT_UP)
}
... ...