Skip to content

Commit 8c4e6ed

Browse files
committed
feat: 添加多环境的打包配置
1 parent ba0cd34 commit 8c4e6ed

5 files changed

Lines changed: 88 additions & 54 deletions

File tree

pom.xml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,4 +158,37 @@
158158
</snapshots>
159159
</pluginRepository>
160160
</pluginRepositories>
161+
162+
<build>
163+
<resources>
164+
<resource>
165+
<directory>src/main/resources</directory>
166+
<filtering>true</filtering>
167+
</resource>
168+
</resources>
169+
</build>
170+
<!--多环境打包-->
171+
<profiles>
172+
<profile>
173+
<id>dev</id>
174+
<properties>
175+
<profileActive>dev</profileActive>
176+
</properties>
177+
<activation>
178+
<activeByDefault>true</activeByDefault>
179+
</activation>
180+
</profile>
181+
<profile>
182+
<id>test</id>
183+
<properties>
184+
<profileActive>test</profileActive>
185+
</properties>
186+
</profile>
187+
<profile>
188+
<id>prod</id>
189+
<properties>
190+
<profileActive>prod</profileActive>
191+
</properties>
192+
</profile>
193+
</profiles>
161194
</project>
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
server:
2+
port: 8000
3+
spring:
4+
redis:
5+
host: localhost
6+
port: 6379
7+
password: ENC(jIiKGruIMgDkKx5wj2gJRCROqPutkTvZ)
8+
database: 0
9+
lettuce:
10+
pool:
11+
max-active: 8
12+
min-idle: 0
13+
max-idle: 8
14+
max-wait: -1
15+
# simple-rest-admin 配置
16+
sra:
17+
config:
18+
dynamic-ds-on: true
19+
swagger-on: true
20+
# 动态数据源配置
21+
dynamic-ds:
22+
master: db1
23+
datasource:
24+
db1:
25+
# url 加上 p6spy 开启 sql 监控
26+
jdbc-url: jdbc:p6spy:mysql://localhost:3306/demo?useSSL=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
27+
driver-class-name: com.p6spy.engine.spy.P6SpyDriver
28+
username: root
29+
password: ENC(donQ3DazAc4/6B+NFSRdxw==)
30+
pool-name: db1_pool
31+
db2:
32+
jdbc-url: jdbc:p6spy:mysql://localhost:3306/demo_cluster?useSSL=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
33+
driver-class-name: com.p6spy.engine.spy.P6SpyDriver
34+
username: root
35+
password: ENC(donQ3DazAc4/6B+NFSRdxw==)
36+
pool-name: db2_pool
37+
# swagger 配置
38+
swagger:
39+
title: Swagger 在线文档
40+
description: simple-rest-admin 在线文档 by swagger2
41+
name: Cade Li
42+
url: https://github.com/cadecode/simple-rest-admin
43+
email: cadecode@foxmail.com
44+
module:
45+
framework: top.cadecode.sra.framework
46+
test: top.cadecode.sra.test
47+
# security 配置
48+
security:
49+
auth-model: jwt
50+
token:
51+
header: token
52+
expiration: 86400
53+
secret: 12345678123456781234567812345678

simple-application/src/main/resources/application-prod.yml

Whitespace-only changes.

simple-application/src/main/resources/application-test.yml

Whitespace-only changes.
Lines changed: 2 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,12 @@
1-
server:
2-
port: 8000
3-
41
# spring config
52
spring:
3+
profiles:
4+
active: @profileActive@
65
application:
76
name: simple-rest-admin
87
jackson:
98
date-format: yyyy-MM-dd HH:mm:ss
109
time-zone: GMT+8
11-
redis:
12-
host: localhost
13-
port: 6379
14-
password: ENC(jIiKGruIMgDkKx5wj2gJRCROqPutkTvZ)
15-
database: 0
16-
lettuce:
17-
pool:
18-
max-active: 8
19-
min-idle: 0
20-
max-idle: 8
21-
max-wait: -1
2210

2311
# mybatis plus 配置
2412
mybatis-plus:
@@ -33,43 +21,3 @@ logging:
3321
file:
3422
path: /log/sra
3523

36-
# simple-rest-admin 配置
37-
sra:
38-
config:
39-
dynamic-ds-on: true
40-
swagger-on: true
41-
# 动态数据源配置
42-
dynamic-ds:
43-
master: db1
44-
datasource:
45-
db1:
46-
# url 加上 p6spy 开启 sql 监控
47-
jdbc-url: jdbc:p6spy:mysql://localhost:3306/demo?useSSL=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
48-
driver-class-name: com.p6spy.engine.spy.P6SpyDriver
49-
username: root
50-
password: ENC(donQ3DazAc4/6B+NFSRdxw==)
51-
pool-name: db1_pool
52-
db2:
53-
jdbc-url: jdbc:p6spy:mysql://localhost:3306/demo_cluster?useSSL=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
54-
driver-class-name: com.p6spy.engine.spy.P6SpyDriver
55-
username: root
56-
password: ENC(donQ3DazAc4/6B+NFSRdxw==)
57-
pool-name: db2_pool
58-
# swagger 配置
59-
swagger:
60-
title: Swagger 在线文档
61-
description: simple-rest-admin 在线文档 by swagger2
62-
name: Cade Li
63-
url: https://github.com/cadecode/simple-rest-admin
64-
email: cadecode@foxmail.com
65-
module:
66-
framework: top.cadecode.sra.framework
67-
test: top.cadecode.sra.test
68-
# security 配置
69-
security:
70-
auth-model: jwt
71-
token:
72-
header: token
73-
expiration: 86400
74-
secret: 12345678123456781234567812345678
75-

0 commit comments

Comments
 (0)