From 8ec021efed6151b43cee0549f471d572dccf2f62 Mon Sep 17 00:00:00 2001
From: liujiandao <274878379@qq.com>
Date: 星期四, 23 十一月 2023 16:09:09 +0800
Subject: [PATCH] 销售明细修改
---
conf/config.go | 36 +++++++++++++++++++++++++++++++++++-
1 files changed, 35 insertions(+), 1 deletions(-)
diff --git a/conf/config.go b/conf/config.go
index 789da01..96fe2b2 100644
--- a/conf/config.go
+++ b/conf/config.go
@@ -8,6 +8,7 @@
"flag"
"github.com/spf13/viper"
"log"
+ "os"
)
var (
@@ -48,6 +49,7 @@
System struct {
Env string // 鐜鍊� develop test public
Port int // 绔彛
+ GrpcPort string //grpc绔彛
DbType string // 鏁版嵁搴撶被鍨�
UseMultipoint bool // 澶氱偣鐧诲綍鎷︽埅
UseRedis bool // 浣跨敤redis
@@ -58,7 +60,9 @@
}
GrpcServiceAddr struct {
- Aps string // jwt绛惧悕
+ Aps string // aps鏈嶅姟鍦板潃
+ Admin string // admin鏈嶅姟鍦板潃
+ WMS string //wms鏈嶅姟鍦板潃
}
config struct {
@@ -111,6 +115,36 @@
if err := Viper.Unmarshal(&Conf); err != nil {
log.Fatalf("Unmarshal err:%v", err)
}
+
+ DBHost := os.Getenv("DB_HOST")
+ DBName := os.Getenv("DB_NAME")
+ DBPort := os.Getenv("DB_PORT")
+ DBUser := os.Getenv("DB_USER")
+ DBPasswd := os.Getenv("DB_PASSWD")
+ if len(DBHost) > 0 &&
+ len(DBName) > 0 &&
+ len(DBPort) > 0 &&
+ len(DBUser) > 0 &&
+ len(DBPasswd) > 0 {
+ Conf.Mysql.Dsn = DBUser + ":" + DBPasswd + "@tcp(" + DBHost + ":" + DBPort + ")/" + DBName + "?charset=utf8&parseTime=True&loc=Local"
+ }
+
+ AdminGrpc := os.Getenv("ADMIN_GRPC")
+ if len(AdminGrpc) > 0 {
+ Conf.GrpcServiceAddr.Admin = AdminGrpc
+ }
+ GrpcPort := os.Getenv("WMS_GRPC")
+ if len(GrpcPort) > 0 {
+ Conf.GrpcServiceAddr.WMS = GrpcPort
+ }
+ ApsGrpc := os.Getenv("GRPC_PORT")
+ Host := os.Getenv("HOST")
+
+ if len(Host) > 0 && len(ApsGrpc) > 0 {
+ Conf.GrpcServiceAddr.Aps = Host + ":" + ApsGrpc
+ //Conf.GrpcServiceAddr.Aps = DBUser + DBUser +
+ }
+
ShowConfig()
CheckConfig()
}
--
Gitblit v1.8.0