添加Spring Cloud Config配置中心支持

This commit is contained in:
macro
2019-10-23 16:40:47 +08:00
parent a4fde176f4
commit ad78ed7910
42 changed files with 502 additions and 351 deletions

View File

@@ -1,29 +0,0 @@
spring:
datasource:
url: jdbc:mysql://localhost:3306/mall?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
username: root
password: root
druid:
initial-size: 5 #连接池初始化大小
min-idle: 10 #最小空闲连接数
max-active: 20 #最大连接数
web-stat-filter:
exclusions: "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*" #不统计这些请求数据
stat-view-servlet: #访问监控网页的登录用户名和密码
login-username: druid
login-password: druid
eureka:
client:
register-with-eureka: true
fetch-registry: true
service-url:
defaultZone: http://localhost:8001/eureka/
registry-fetch-interval-seconds: 10
management: #开启SpringBoot Admin的监控
endpoints:
web:
exposure:
include: '*'
endpoint:
health:
show-details: always

View File

@@ -1,16 +0,0 @@
spring:
datasource:
url: jdbc:mysql://db:3306/mall?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
username: reader
password: 123456
druid:
initial-size: 5 #连接池初始化大小
min-idle: 10 #最小空闲连接数
max-active: 20 #最大连接数
web-stat-filter:
exclusions: "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*" #不统计这些请求数据
stat-view-servlet: #访问监控网页的登录用户名和密码
login-username: druid
login-password: druid
logging:
path: /var/logs #配置日志生成路径

View File

@@ -1,34 +1,38 @@
spring:
profiles:
active: dev #默认为开发环境
application:
name: mall-admin
server:
port: 8180
spring:
datasource:
url: jdbc:mysql://localhost:3306/mall?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
username: root
password: root
druid:
initial-size: 5 #连接池初始化大小
min-idle: 10 #最小空闲连接数
max-active: 20 #最大连接数
web-stat-filter:
exclusions: "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*" #不统计这些请求数据
stat-view-servlet: #访问监控网页的登录用户名和密码
login-username: druid
login-password: druid
rabbitmq: #rabbitmq相关配置
host: localhost
port: 5672
username: guest
password: guest
mybatis:
mapper-locations:
- classpath:dao/*.xml
- classpath*:com/**/mapper/*.xml
management: #开启SpringBoot Admin的监控
endpoints:
web:
exposure:
include: '*'
endpoint:
health:
show-details: always
jwt:
tokenHeader: Authorization #JWT存储的请求头
secret: mySecret #JWT加解密使用的密钥
expiration: 604800 #JWT的超期限时间(60*60*24)
tokenHead: Bearer #JWT负载中拿到开头
aliyun:
oss:
endpoint: oss-cn-shenzhen.aliyuncs.com # oss对外服务的访问域名
accessKeyId: test # 访问身份验证中用到用户标识
accessKeySecret: test # 用户用于加密签名字符串和oss用来验证签名字符串的密钥
bucketName: macro-oss # oss的存储空间
policy:
expire: 300 # 签名有效期(S)
maxSize: 10 # 上传文件大小(M)
callback: http://39.98.190.128:8080/aliyun/oss/callback # 文件上传成功后的回调地址
dir:
prefix: mall/images/ # 上传文件夹路径前缀
logging:
level:
root: info #日志配置DEBUG,INFO,WARN,ERROR
com.macro.mall: debug
# file: demo_log.log #配置日志生成路径
# path: /var/logs #配置日志文件名称
tokenHead: Bearer #JWT负载中拿到开头

View File

@@ -0,0 +1,13 @@
spring:
cloud:
config:
profile: dev #启用环境名称
label: master #分支名称
name: admin #配置文件名称
discovery:
enabled: true
service-id: mall-config
eureka:
client:
service-url:
defaultZone: http://localhost:8001/eureka/

View File

@@ -0,0 +1,13 @@
spring:
cloud:
config:
profile: prod #启用环境名称
label: master #分支名称
name: admin #配置文件名称
discovery:
enabled: true
service-id: mall-config
eureka:
client:
service-url:
defaultZone: http://localhost:8001/eureka/

View File

@@ -0,0 +1,5 @@
spring:
profiles:
active: dev
application:
name: mall-admin