From 73a3d53bfcfa0fde7b9ea2a14c8bcfea42ebf3ad Mon Sep 17 00:00:00 2001
From: lishihai <dslsh@dscom>
Date: 星期四, 13 六月 2024 10:50:00 +0800
Subject: [PATCH] 概述(一级模块)-入库(二级模块)-新建时保存新建单据人信息;验证时保存验证人信息
---
conf/config.go | 72 ++++++++++++++++++++++++++++-------
1 files changed, 57 insertions(+), 15 deletions(-)
diff --git a/conf/config.go b/conf/config.go
index 59e6c92..8f40e75 100644
--- a/conf/config.go
+++ b/conf/config.go
@@ -23,27 +23,45 @@
type (
webConf struct {
- Host string // 鏈満ip鍦板潃
- Port string // 绔彛鍙�
- NodeId string // 涓昏处鎴风敤鎴峰悕
- OssType string // 瀵硅薄瀛樺偍绫诲瀷
- JWTSecret string
- FileServer string //鏂囦欢鏈嶅姟鍣ㄥ湴鍧�
- ServerId string //鏈嶅姟ID
- GrpcPort string //grpc绔彛鍙�
+ Host string // 鏈満ip鍦板潃
+ Port string // 绔彛鍙�
+ NodeId string // 涓昏处鎴风敤鎴峰悕
+ OssType string // 瀵硅薄瀛樺偍绫诲瀷
+ JWTSecret string
+ FileServer string //鏂囦欢鏈嶅姟鍣ㄥ湴鍧�
+ ServerId string //鏈嶅姟ID
+ GrpcPort string //grpc绔彛鍙�
+ CompanyName string //鍏徃鍚�
}
localConf struct {
StorePath string // 鏈湴鏂囦欢瀛樺偍璺緞
}
+
+ grpcServerConf struct {
+ ApsAddr string //aps鏈嶅姟grpc鍦板潃
+ CrmAddr string //crm鏈嶅姟grpc鍦板潃
+ SrmAddr string //srm鏈嶅姟grpc鍦板潃
+ }
+
+ fileTemplateConf struct {
+ InputSelfmadeAddr string //鍏ュ簱鑷埗鍗曟ā鐗堝湴鍧�
+ }
+
+ dingTalkConf struct {
+ AlarmKey string
+ AlarmUrl string
+ }
)
var (
- WebConf = &webConf{}
- LogConf = &logx.Conf{}
- DbConf = &mysqlx.Conf{}
- LocalConf = &localConf{}
- Viper *viper.Viper
+ WebConf = &webConf{}
+ LogConf = &logx.Conf{}
+ DbConf = &mysqlx.Conf{}
+ LocalConf = &localConf{}
+ Viper *viper.Viper
+ GrpcServerConf = &grpcServerConf{}
+ DingTalkConf = &dingTalkConf{}
)
func Init() error {
@@ -58,13 +76,33 @@
}
read2Conf(Viper)
- nodeId := os.Getenv("NODE_ID") // 涓昏处鎴风敤鎴峰悕
- host := os.Getenv("HOST") // 鏈満IP鍦板潃
+ nodeId := os.Getenv("NODE_ID") // 涓昏处鎴风敤鎴峰悕
+ host := os.Getenv("HOST") // 鏈満IP鍦板潃
+ GrpcPort := os.Getenv("WMS_GRPC") // 鍙澶栨彁渚沢rpc鏈嶅姟锛屾湰鏈嶅姟涓嶇敤
+ apsAddr := os.Getenv("APS_GRPC")
+ crmAddr := os.Getenv("CRM_GRPC")
+ srmAddr := os.Getenv("SRM_GRPC")
+ companyName := os.Getenv("COMPANY_NAME")
+ if len(GrpcPort) > 0 {
+ WebConf.GrpcPort = GrpcPort
+ }
if len(nodeId) > 0 {
WebConf.NodeId = nodeId
}
if len(host) > 0 {
WebConf.Host = host
+ }
+ if len(apsAddr) > 0 {
+ GrpcServerConf.ApsAddr = apsAddr
+ }
+ if len(crmAddr) > 0 {
+ GrpcServerConf.CrmAddr = crmAddr
+ }
+ if len(srmAddr) > 0 {
+ GrpcServerConf.SrmAddr = srmAddr
+ }
+ if len(companyName) > 0 {
+ WebConf.CompanyName = companyName
}
DBHost := os.Getenv("DB_HOST")
@@ -88,6 +126,8 @@
_ = v.UnmarshalKey("log", LogConf)
_ = v.UnmarshalKey("db", DbConf)
_ = v.UnmarshalKey("local", LocalConf)
+ _ = v.UnmarshalKey("grpcServer", GrpcServerConf)
+ _ = v.UnmarshalKey("dingTalk", DingTalkConf)
showConfig()
}
@@ -97,5 +137,7 @@
log.Printf(" LogConf: %+v", LogConf)
log.Printf(" DbConf: %+v", DbConf)
log.Printf(" LocalConf: %+v", LocalConf)
+ log.Printf(" GrpcServerConf: %+v", GrpcServerConf)
+ log.Printf(" DingTalkConf: %+v", DingTalkConf)
log.Println("......................................................")
}
--
Gitblit v1.8.0