From 10c65da3d2af7056f48d9301e83f53f102f76e18 Mon Sep 17 00:00:00 2001 From: zhangqian <zhangqian@123.com> Date: 星期一, 30 十月 2023 14:52:11 +0800 Subject: [PATCH] fix --- conf/config.go | 49 ++++++++++++++++++++++++++----------------------- 1 files changed, 26 insertions(+), 23 deletions(-) diff --git a/conf/config.go b/conf/config.go index 4e9f6b0..1888f21 100644 --- a/conf/config.go +++ b/conf/config.go @@ -3,7 +3,6 @@ import ( "apsClient/pkg/convertx" "apsClient/pkg/logx" - "apsClient/pkg/redisx" "apsClient/pkg/sqlitex" "github.com/spf13/viper" "log" @@ -25,13 +24,6 @@ System struct { Env string // 鐜鍊� develop test public Port int // 绔彛 - DbType string // 鏁版嵁搴撶被鍨� - UseMultipoint bool // 澶氱偣鐧诲綍鎷︽埅 - UseRedis bool // 浣跨敤redis - LimitCountIP int - LimitTimeIP int - RouterPrefix string // 璺敱鍓嶇紑 - SudoPassword string // sudo瀵嗙爜 DeviceId string //璁惧id NetSetShellPath string //缃戠粶璁剧疆鑴氭湰璺緞 NetUpShellName string //缃戠粶鍋滅敤鑴氭湰 @@ -66,12 +58,27 @@ Services struct { ApsServer string + Serial string } nsqConf struct { NodeId string NsqdAddr string NsqlookupdAddr string + } + + plc struct { + FinishNumberTimeInterval int + TotalNumberTimeInterval int + ModbusIntType string + SlaveId int + Package string + StandbyTime int64 + } + + Prompt struct { + SafeProduce string `json:"safeProduce,omitempty"` + PlcNotConnected string `json:"plcNotConnected,omitempty"` } config struct { @@ -84,22 +91,16 @@ // mysql閰嶇疆 Sqlite sqlitex.Conf - // redis閰嶇疆 - Redis redisx.Conf - - // etcd閰嶇疆 - Etcd Etcd - - // rancher閰嶇疆 - Rancher Rancher - - // k8s閰嶇疆 - K8s K8s - //Services Address Services Services + //NsqConf NsqConf nsqConf + + //PLC + PLC plc + + Prompt Prompt } ) @@ -122,6 +123,9 @@ if err := Viper.Unmarshal(&Conf); err != nil { log.Fatalf("Unmarshal err:%v", err) } + if Conf.PLC.StandbyTime == 0 { + Conf.PLC.StandbyTime = 300 //5鍒嗛挓 + } ShowConfig() } @@ -138,8 +142,7 @@ log.Println("......................................................") log.Printf(" System: %+v", Conf.System) log.Printf(" Log: %+v", Conf.Log) - log.Printf(" etcd: %+v", Conf.Etcd) - log.Printf(" rancher: %+v", Conf.Rancher) - log.Printf(" k8s: %+v", Conf.K8s) + log.Printf(" plc : %+v", Conf.PLC) + log.Printf(" services : %+v", Conf.Services) log.Println("......................................................") } -- Gitblit v1.8.0