正在显示
4 个修改的文件
包含
52 行增加
和
5 行删除
1 | FROM golang:latest | 1 | FROM golang:latest |
2 | -MAINTAINER <> | ||
3 | ENV APP_DIR $GOPATH/src/project | 2 | ENV APP_DIR $GOPATH/src/project |
4 | RUN mkdir -p $APP_DIR | 3 | RUN mkdir -p $APP_DIR |
5 | WORKDIR $APP_DIR/ | 4 | WORKDIR $APP_DIR/ |
@@ -11,6 +10,6 @@ RUN ["ln","-sf","/usr/share/zoneinfo/Asia/Shanghai","/etc/localtime"] | @@ -11,6 +10,6 @@ RUN ["ln","-sf","/usr/share/zoneinfo/Asia/Shanghai","/etc/localtime"] | ||
11 | ENV GO111MODULE on | 10 | ENV GO111MODULE on |
12 | ENV GOPROXY https://goproxy.io | 11 | ENV GOPROXY https://goproxy.io |
13 | RUN ["go","mod","tidy"] | 12 | RUN ["go","mod","tidy"] |
14 | -RUN ["ls"] | ||
15 | RUN ["go","build"] | 13 | RUN ["go","build"] |
16 | -ENTRYPOINT ["./project"] | ||
14 | +RUN ["ls"] | ||
15 | +ENTRYPOINT ["./allied-creation-gateway"] |
@@ -52,12 +52,51 @@ spec: | @@ -52,12 +52,51 @@ spec: | ||
52 | - mountPath: /opt/logs | 52 | - mountPath: /opt/logs |
53 | name: accesslogs | 53 | name: accesslogs |
54 | env: | 54 | env: |
55 | + - name: POSTGRESQL_DB_NAME | ||
56 | + valueFrom: | ||
57 | + configMapKeyRef: | ||
58 | + name: suplus-config | ||
59 | + key: postgresqlalliedcreation.dbname | ||
60 | + - name: POSTGRESQL_USER | ||
61 | + valueFrom: | ||
62 | + configMapKeyRef: | ||
63 | + name: suplus-config | ||
64 | + key: postgresql.user | ||
65 | + - name: POSTGRESQL_PASSWORD | ||
66 | + valueFrom: | ||
67 | + configMapKeyRef: | ||
68 | + name: suplus-config | ||
69 | + key: postgresql.password | ||
70 | + - name: POSTGRESQL_HOST | ||
71 | + valueFrom: | ||
72 | + configMapKeyRef: | ||
73 | + name: suplus-config | ||
74 | + key: postgresql.host | ||
75 | + - name: POSTGRESQL_PORT | ||
76 | + valueFrom: | ||
77 | + configMapKeyRef: | ||
78 | + name: suplus-config | ||
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: "" | ||
55 | - name: LOG_LEVEL | 92 | - name: LOG_LEVEL |
56 | value: "debug" | 93 | value: "debug" |
57 | - name: ERROR_BASE_CODE | 94 | - name: ERROR_BASE_CODE |
58 | value: "1" | 95 | value: "1" |
59 | - name: ERROR_BASE_CODE_MULTIPLE | 96 | - name: ERROR_BASE_CODE_MULTIPLE |
60 | value: "1000" | 97 | value: "1000" |
98 | + - name: HTTP_PORT | ||
99 | + value: "8082" | ||
61 | volumes: | 100 | volumes: |
62 | - name: accesslogs | 101 | - name: accesslogs |
63 | emptyDir: {} | 102 | emptyDir: {} |
1 | package constant | 1 | package constant |
2 | 2 | ||
3 | -import "os" | 3 | +import ( |
4 | + "os" | ||
5 | + "strconv" | ||
6 | +) | ||
4 | 7 | ||
5 | const SERVICE_NAME = "project" | 8 | const SERVICE_NAME = "project" |
6 | 9 | ||
7 | var LOG_LEVEL = "debug" | 10 | var LOG_LEVEL = "debug" |
8 | 11 | ||
12 | +var HTTP_PORT int = 8081 | ||
13 | + | ||
9 | //天联共创基础模块 | 14 | //天联共创基础模块 |
10 | var ALLIED_CREATION_BASIC_HOST = "http://localhost:8080" | 15 | var ALLIED_CREATION_BASIC_HOST = "http://localhost:8080" |
11 | 16 | ||
@@ -28,4 +33,7 @@ func init() { | @@ -28,4 +33,7 @@ func init() { | ||
28 | if os.Getenv("ALLIED_CREATION_USER_HOST") != "" { | 33 | if os.Getenv("ALLIED_CREATION_USER_HOST") != "" { |
29 | ALLIED_CREATION_USER_HOST = os.Getenv("ALLIED_CREATION_USER_HOST") | 34 | ALLIED_CREATION_USER_HOST = os.Getenv("ALLIED_CREATION_USER_HOST") |
30 | } | 35 | } |
36 | + if os.Getenv("HTTP_PORT") != "" { | ||
37 | + HTTP_PORT, _ = strconv.Atoi(os.Getenv("HTTP_PORT")) | ||
38 | + } | ||
31 | } | 39 | } |
@@ -3,6 +3,7 @@ package beego | @@ -3,6 +3,7 @@ package beego | ||
3 | import ( | 3 | import ( |
4 | "encoding/json" | 4 | "encoding/json" |
5 | "github.com/beego/beego/v2/server/web/context" | 5 | "github.com/beego/beego/v2/server/web/context" |
6 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/constant" | ||
6 | "os" | 7 | "os" |
7 | "strconv" | 8 | "strconv" |
8 | 9 | ||
@@ -17,7 +18,7 @@ func init() { | @@ -17,7 +18,7 @@ func init() { | ||
17 | web.BConfig.AppName = "project" | 18 | web.BConfig.AppName = "project" |
18 | web.BConfig.CopyRequestBody = true | 19 | web.BConfig.CopyRequestBody = true |
19 | web.BConfig.RunMode = "dev" | 20 | web.BConfig.RunMode = "dev" |
20 | - web.BConfig.Listen.HTTPPort = 8080 | 21 | + web.BConfig.Listen.HTTPPort = constant.HTTP_PORT |
21 | web.BConfig.Listen.EnableAdmin = false | 22 | web.BConfig.Listen.EnableAdmin = false |
22 | web.BConfig.WebConfig.CommentRouterPath = "/pkg/port/beego/routers" | 23 | web.BConfig.WebConfig.CommentRouterPath = "/pkg/port/beego/routers" |
23 | if os.Getenv("RUN_MODE") != "" { | 24 | if os.Getenv("RUN_MODE") != "" { |
-
请 注册 或 登录 后发表评论