1 Star 0 Fork 2

ThingsPanel / mindjoy-wm-protocol-plugin

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
main.go 936 Bytes
一键复制 编辑 原始数据 按行查看 历史
hezhuozhuo 提交于 2024-04-11 11:28 . fix bug
package main
import (
"log"
"strings"
httpclient "tp-plugin/http_client"
httpservice "tp-plugin/http_service"
deviceconfig "tp-plugin/services"
"github.com/spf13/viper"
)
func main() {
conf()
log.Println("Starting the application...")
LogInIt()
// 启动mqtt客户端
//mqtt.InitClient()
// 启动http客户端
httpclient.Init()
// 启动服务
deviceconfig.Start()
// 启动http服务
httpservice.Init()
// 订阅平台下发的消息
//mqtt.Subscribe()
select {}
}
// 加载配置文件
func conf() {
log.Println("加载配置文件...")
// 设置环境变量前缀
viper.SetEnvPrefix("PLUGIN")
// 使 Viper 能够读取系统环境变量
viper.AutomaticEnv()
viper.SetEnvKeyReplacer(strings.NewReplacer(".", "_"))
viper.SetConfigType("yaml")
viper.SetConfigFile("./config.yaml")
err := viper.ReadInConfig()
if err != nil {
log.Println(err.Error())
}
log.Println("加载配置文件完成...")
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ThingsPanel/mindjoy-wm-protocol-plugin.git
git@gitee.com:ThingsPanel/mindjoy-wm-protocol-plugin.git
ThingsPanel
mindjoy-wm-protocol-plugin
mindjoy-wm-protocol-plugin
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891