作者 yangfu

Dockerfile修改

@@ -12,4 +12,4 @@ ENV GOPROXY https://goproxy.io @@ -12,4 +12,4 @@ ENV GOPROXY https://goproxy.io
12 RUN ["go","mod","tidy"] 12 RUN ["go","mod","tidy"]
13 RUN ["go","build"] 13 RUN ["go","build"]
14 RUN ["ls"] 14 RUN ["ls"]
15 -ENTRYPOINT ["./project"]  
  15 +ENTRYPOINT ["./allied-creation-user"]
@@ -77,6 +77,18 @@ spec: @@ -77,6 +77,18 @@ spec:
77 configMapKeyRef: 77 configMapKeyRef:
78 name: suplus-config 78 name: suplus-config
79 key: postgresql.port 79 key: postgresql.port
  80 + - name: REDIS_HOST
  81 + valueFrom:
  82 + configMapKeyRef:
  83 + name: suplus-config
  84 + key: redis.ip
  85 + - name: REDIS_PORT
  86 + valueFrom:
  87 + configMapKeyRef:
  88 + name: suplus-config
  89 + key: redis.port
  90 + - name: REDIS_AUTH
  91 + value: ""
80 - name: LOG_LEVEL 92 - name: LOG_LEVEL
81 value: "debug" 93 value: "debug"
82 - name: ERROR_BASE_CODE 94 - name: ERROR_BASE_CODE
@@ -85,6 +97,8 @@ spec: @@ -85,6 +97,8 @@ spec:
85 value: "1000" 97 value: "1000"
86 - name: ENABLE_KAFKA_LOG 98 - name: ENABLE_KAFKA_LOG
87 value: "true" 99 value: "true"
  100 + - name: HTTP_PORT
  101 + value: "8082"
88 volumes: 102 volumes:
89 - name: accesslogs 103 - name: accesslogs
90 emptyDir: {} 104 emptyDir: {}
@@ -9,6 +9,7 @@ import ( @@ -9,6 +9,7 @@ import (
9 9
10 var SERVICE_NAME = "allied-creation-user" 10 var SERVICE_NAME = "allied-creation-user"
11 var SERVICE_ENV = "dev" 11 var SERVICE_ENV = "dev"
  12 +var HTTP_PORT int = 8081
12 var CACHE_PREFIX = "allied-creation-user-dev" 13 var CACHE_PREFIX = "allied-creation-user-dev"
13 var LOG_LEVEL = "debug" 14 var LOG_LEVEL = "debug"
14 15
@@ -43,5 +44,8 @@ func init() { @@ -43,5 +44,8 @@ func init() {
43 if os.Getenv("SERVICE_ENV") != "" { 44 if os.Getenv("SERVICE_ENV") != "" {
44 SERVICE_ENV = os.Getenv("SERVICE_ENV") 45 SERVICE_ENV = os.Getenv("SERVICE_ENV")
45 } 46 }
  47 + if os.Getenv("HTTP_PORT") != "" {
  48 + HTTP_PORT, _ = strconv.Atoi(os.Getenv("HTTP_PORT"))
  49 + }
46 CACHE_PREFIX = fmt.Sprintf("%v-%v", SERVICE_NAME, SERVICE_ENV) 50 CACHE_PREFIX = fmt.Sprintf("%v-%v", SERVICE_NAME, SERVICE_ENV)
47 } 51 }
@@ -5,6 +5,7 @@ import ( @@ -5,6 +5,7 @@ import (
5 "github.com/beego/beego/v2/server/web/context" 5 "github.com/beego/beego/v2/server/web/context"
6 "github.com/linmadan/egglib-go/log" 6 "github.com/linmadan/egglib-go/log"
7 "github.com/linmadan/egglib-go/web/beego/filters" 7 "github.com/linmadan/egglib-go/web/beego/filters"
  8 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/constant"
8 "os" 9 "os"
9 "strconv" 10 "strconv"
10 11
@@ -16,7 +17,7 @@ func init() { @@ -16,7 +17,7 @@ func init() {
16 web.BConfig.AppName = "project" 17 web.BConfig.AppName = "project"
17 web.BConfig.CopyRequestBody = true 18 web.BConfig.CopyRequestBody = true
18 web.BConfig.RunMode = "dev" 19 web.BConfig.RunMode = "dev"
19 - web.BConfig.Listen.HTTPPort = 8081 20 + web.BConfig.Listen.HTTPPort = constant.HTTP_PORT
20 web.BConfig.Listen.EnableAdmin = false 21 web.BConfig.Listen.EnableAdmin = false
21 web.BConfig.WebConfig.CommentRouterPath = "/pkg/port/beego/routers" 22 web.BConfig.WebConfig.CommentRouterPath = "/pkg/port/beego/routers"
22 if os.Getenv("RUN_MODE") != "" { 23 if os.Getenv("RUN_MODE") != "" {