refactor(config): 重构配置文件并添加环境变量支持

- 在 application-test.properties 文件中,将所有配置项前添加 "#" 注释符,暂时禁用这些配置
- 在 bootstrap.properties 文件中:
  - 添加 profiles_active 环境变量,用于动态设置 Spring Profile - 更新 nacos server-addr配置,使用环境变量 ${nacos_server_addr},默认值为 81.70.164.178:8848
  - 优化 nacos 配置相关设置,引入 namespace 概念
  - 添加 nacos discovery 相关配置
  - 更新 spring-boot-actuator 相关配置的注释
  - 修改允许 bean 定义覆盖的配置项注释
This commit is contained in:
duzhichao
2025-07-23 17:59:49 +08:00
parent 46a15b25bd
commit d3ac51e988
2 changed files with 84 additions and 79 deletions
@@ -1,68 +1,68 @@
########################## 统一变量配置 ##########################
##### 数据库配置
zlt.datasource.ip=127.0.0.1
zlt.datasource.username=root
zlt.datasource.password=root
##### redis配置
spring.data.redis.host=192.168.2.20
spring.data.redis.port=6379
spring.data.redis.password=ikingtec123456
spring.data.redis.database=8
spring.data.redis.timeout=5000
##### elasticsearch配置
zlt.elasticsearch.uris=119.45.169.13:9200
zlt.elasticsearch.username=elastic
zlt.elasticsearch.password=iot123456@
##### sentinel配置
zlt.sentinel.dashboard=192.168.28.130:6999
##### fastDFS配置
zlt.fdfs.web-url=192.168.28.130
zlt.fdfs.trackerList=${zlt.fdfs.web-url}:22122
##### s3配置
zlt.s3.access-key=33RdDbIlEFK0z9IJHSqx
zlt.s3.accessKeySecret=mmfSh4gjJm8dck0KaG6fKItpIM3tenWVHS4Ygjlm
zlt.s3.endpoint=http://81.70.164.178:9000
zlt.s3.bucketName=gofly
zlt.oss.secretId=LTAI5tSNV1RvexXpMMCZhxSe
zlt.oss.secretKey=XocJRWU8emwjjvYLTrc04l91VZMkQK
zlt.oss.endpoint=https://oss-cn-beijing.aliyuncs.com
zlt.oss.bucketName=goflyapp
#### cos配置
zlt.cos.secretId=AKIDkMn6B3h7KJ5dIkyzpRr7C6mFUqFWbu1u
zlt.cos.secretKey=jDThssfEZieS4S8bqsgIiAUdbXVVYgdQ
zlt.cos.endpoint=gofly-1333114031.cos.ap-nanjing.myqcloud.com
zlt.cos.bucketName=gofly-1333114031
zlt.cos.region=ap-nanjing
##### 日志链路追踪
zlt.trace.enable=true
zlt.security.tencent.appId=wx30a3c8de94a85584
zlt.security.tencent.appSecret=e64d6e3dcfe88d0daee50e77f5a2ee69
zlt.security.tencent.token=YPbzETU8oe3XguGgwtA4g1DqlFKvw7pT
zlt.security.tencent.encodingAESKey=YPbzETU8oe3XguGgwtA4g1DqlFKvw7pTZiyHTxCiQxh
zlt.security.tencent.templateId=YOUR_TEMPLATE_ID
zlt.security.tencent.jscode2sessionUrl=https://api.weixin.qq.com/sns/jscode2session
zlt.security.tencent.accessTokenUrl=https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=${zlt.security.tencent.appId}&secret=${zlt.security.tencent.appSecret}
# 微信支付商户号
zlt.wxpay.merchantId=1703796518
# 商户证书序列号
zlt.wxpay.merchantSerialNumber=11F4AC03C50EB582D3EDE082591D1F9A65388D51
# 微信支付申请的应用ID
zlt.wxpay.appId=wx30a3c8de94a85584
# 微信支付异步通知地址(需外网可访问且与微信支付平台配置一致)
zlt.wxpay.notifyUrl=http://your_domain/weixin/pay/notify
# 商户API私钥路径
zlt.wxpay.privateKeyPath=D:\\wx\\WXCertUtil\\cert\\1703796518_20250114_cert\\apiclient_key.pem
# 商户APIV3密钥
zlt.wxpay.apiV3Key=aIt5Vw3cYXSCSd4L5h14kIyDsoXBow7r
########################### 统一变量配置 ##########################
###### 数据库配置
#zlt.datasource.ip=127.0.0.1
#zlt.datasource.username=root
#zlt.datasource.password=root
#
###### redis配置
#spring.data.redis.host=192.168.2.20
#spring.data.redis.port=6379
#spring.data.redis.password=ikingtec123456
#spring.data.redis.database=8
#spring.data.redis.timeout=5000
#
#
#
###### elasticsearch配置
#zlt.elasticsearch.uris=119.45.169.13:9200
#zlt.elasticsearch.username=elastic
#zlt.elasticsearch.password=iot123456@
#
###### sentinel配置
#zlt.sentinel.dashboard=192.168.28.130:6999
#
###### fastDFS配置
#zlt.fdfs.web-url=192.168.28.130
#zlt.fdfs.trackerList=${zlt.fdfs.web-url}:22122
#
###### s3配置
#zlt.s3.access-key=33RdDbIlEFK0z9IJHSqx
#zlt.s3.accessKeySecret=mmfSh4gjJm8dck0KaG6fKItpIM3tenWVHS4Ygjlm
#zlt.s3.endpoint=http://81.70.164.178:9000
#zlt.s3.bucketName=gofly
#
#zlt.oss.secretId=LTAI5tSNV1RvexXpMMCZhxSe
#zlt.oss.secretKey=XocJRWU8emwjjvYLTrc04l91VZMkQK
#zlt.oss.endpoint=https://oss-cn-beijing.aliyuncs.com
#zlt.oss.bucketName=goflyapp
#
##### cos配置
#zlt.cos.secretId=AKIDkMn6B3h7KJ5dIkyzpRr7C6mFUqFWbu1u
#zlt.cos.secretKey=jDThssfEZieS4S8bqsgIiAUdbXVVYgdQ
#zlt.cos.endpoint=gofly-1333114031.cos.ap-nanjing.myqcloud.com
#zlt.cos.bucketName=gofly-1333114031
#zlt.cos.region=ap-nanjing
#
###### 日志链路追踪
#zlt.trace.enable=true
#
#zlt.security.tencent.appId=wx30a3c8de94a85584
#zlt.security.tencent.appSecret=e64d6e3dcfe88d0daee50e77f5a2ee69
#zlt.security.tencent.token=YPbzETU8oe3XguGgwtA4g1DqlFKvw7pT
#zlt.security.tencent.encodingAESKey=YPbzETU8oe3XguGgwtA4g1DqlFKvw7pTZiyHTxCiQxh
#zlt.security.tencent.templateId=YOUR_TEMPLATE_ID
#zlt.security.tencent.jscode2sessionUrl=https://api.weixin.qq.com/sns/jscode2session
#zlt.security.tencent.accessTokenUrl=https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=${zlt.security.tencent.appId}&secret=${zlt.security.tencent.appSecret}
#
## 微信支付商户号
#zlt.wxpay.merchantId=1703796518
## 商户证书序列号
#zlt.wxpay.merchantSerialNumber=11F4AC03C50EB582D3EDE082591D1F9A65388D51
## 微信支付申请的应用ID
#zlt.wxpay.appId=wx30a3c8de94a85584
## 微信支付异步通知地址(需外网可访问且与微信支付平台配置一致)
#zlt.wxpay.notifyUrl=http://your_domain/weixin/pay/notify
## 商户API私钥路径
#zlt.wxpay.privateKeyPath=D:\\wx\\WXCertUtil\\cert\\1703796518_20250114_cert\\apiclient_key.pem
## 商户APIV3密钥
#zlt.wxpay.apiV3Key=aIt5Vw3cYXSCSd4L5h14kIyDsoXBow7r