From cb0affa2cf571fbe89ae1b5c2869d22358719d17 Mon Sep 17 00:00:00 2001 From: zhangjf Date: Sun, 22 Feb 2026 15:25:17 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E8=A1=A5=E5=85=85env.properties?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=8F=82=E6=95=B0=E8=A6=86=E7=9B=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增Redis连接池配置参数 - 新增Hikari连接池公共配置参数 - 新增Sentinel配置参数 - 新增网关限流配置参数 - 新增腾讯云COS配置参数 - 新增文件上传配置参数 - 各服务application.yml引用对应环境变量 --- .../3.3.2/m2e-lastUpdated.properties | 4 +- .../3.11.0/m2e-lastUpdated.properties | 4 +- .../3.1.1/m2e-lastUpdated.properties | 4 +- .../3.1.1/m2e-lastUpdated.properties | 4 +- .../3.3.0/m2e-lastUpdated.properties | 4 +- .../3.3.1/m2e-lastUpdated.properties | 4 +- .../3.12.1/m2e-lastUpdated.properties | 4 +- .../3.1.2/m2e-lastUpdated.properties | 4 +- .../3.2.0/m2e-lastUpdated.properties | 4 +- fund-cust/src/main/resources/application.yml | 4 +- fund-exp/src/main/resources/application.yml | 4 +- fund-file/src/main/resources/application.yml | 10 ++--- .../src/main/resources/application.yml | 8 ++-- fund-proj/src/main/resources/application.yml | 4 +- .../src/main/resources/application.yml | 4 +- fund-req/src/main/resources/application.yml | 4 +- fund-sys/src/main/resources/application.yml | 10 ++--- scripts/env.properties | 41 +++++++++++++++++++ 18 files changed, 83 insertions(+), 42 deletions(-) diff --git a/.mvn/repository/org/apache/maven/plugins/maven-clean-plugin/3.3.2/m2e-lastUpdated.properties b/.mvn/repository/org/apache/maven/plugins/maven-clean-plugin/3.3.2/m2e-lastUpdated.properties index bd9a01e..53b333f 100644 --- a/.mvn/repository/org/apache/maven/plugins/maven-clean-plugin/3.3.2/m2e-lastUpdated.properties +++ b/.mvn/repository/org/apache/maven/plugins/maven-clean-plugin/3.3.2/m2e-lastUpdated.properties @@ -1,2 +1,2 @@ -#Sun Feb 22 14:41:27 CST 2026 -central|https\://repo1.maven.org/maven2|null=1771742487357 +#Sun Feb 22 15:20:13 CST 2026 +central|https\://repo1.maven.org/maven2|null=1771744813429 diff --git a/.mvn/repository/org/apache/maven/plugins/maven-compiler-plugin/3.11.0/m2e-lastUpdated.properties b/.mvn/repository/org/apache/maven/plugins/maven-compiler-plugin/3.11.0/m2e-lastUpdated.properties index 630c4d0..8c123af 100644 --- a/.mvn/repository/org/apache/maven/plugins/maven-compiler-plugin/3.11.0/m2e-lastUpdated.properties +++ b/.mvn/repository/org/apache/maven/plugins/maven-compiler-plugin/3.11.0/m2e-lastUpdated.properties @@ -1,2 +1,2 @@ -#Sun Feb 22 14:41:27 CST 2026 -central|https\://repo1.maven.org/maven2|null=1771742487369 +#Sun Feb 22 15:20:13 CST 2026 +central|https\://repo1.maven.org/maven2|null=1771744813439 diff --git a/.mvn/repository/org/apache/maven/plugins/maven-deploy-plugin/3.1.1/m2e-lastUpdated.properties b/.mvn/repository/org/apache/maven/plugins/maven-deploy-plugin/3.1.1/m2e-lastUpdated.properties index c18a253..8ec82e0 100644 --- a/.mvn/repository/org/apache/maven/plugins/maven-deploy-plugin/3.1.1/m2e-lastUpdated.properties +++ b/.mvn/repository/org/apache/maven/plugins/maven-deploy-plugin/3.1.1/m2e-lastUpdated.properties @@ -1,2 +1,2 @@ -#Sun Feb 22 14:41:27 CST 2026 -central|https\://repo1.maven.org/maven2|null=1771742487399 +#Sun Feb 22 15:20:13 CST 2026 +central|https\://repo1.maven.org/maven2|null=1771744813443 diff --git a/.mvn/repository/org/apache/maven/plugins/maven-install-plugin/3.1.1/m2e-lastUpdated.properties b/.mvn/repository/org/apache/maven/plugins/maven-install-plugin/3.1.1/m2e-lastUpdated.properties index c9cf2e7..63fec07 100644 --- a/.mvn/repository/org/apache/maven/plugins/maven-install-plugin/3.1.1/m2e-lastUpdated.properties +++ b/.mvn/repository/org/apache/maven/plugins/maven-install-plugin/3.1.1/m2e-lastUpdated.properties @@ -1,2 +1,2 @@ -#Sun Feb 22 14:41:27 CST 2026 -central|https\://repo1.maven.org/maven2|null=1771742487396 +#Sun Feb 22 15:20:13 CST 2026 +central|https\://repo1.maven.org/maven2|null=1771744813442 diff --git a/.mvn/repository/org/apache/maven/plugins/maven-jar-plugin/3.3.0/m2e-lastUpdated.properties b/.mvn/repository/org/apache/maven/plugins/maven-jar-plugin/3.3.0/m2e-lastUpdated.properties index 0b4624f..47ae764 100644 --- a/.mvn/repository/org/apache/maven/plugins/maven-jar-plugin/3.3.0/m2e-lastUpdated.properties +++ b/.mvn/repository/org/apache/maven/plugins/maven-jar-plugin/3.3.0/m2e-lastUpdated.properties @@ -1,2 +1,2 @@ -#Sun Feb 22 14:41:27 CST 2026 -central|https\://repo1.maven.org/maven2|null=1771742487373 +#Sun Feb 22 15:20:13 CST 2026 +central|https\://repo1.maven.org/maven2|null=1771744813440 diff --git a/.mvn/repository/org/apache/maven/plugins/maven-resources-plugin/3.3.1/m2e-lastUpdated.properties b/.mvn/repository/org/apache/maven/plugins/maven-resources-plugin/3.3.1/m2e-lastUpdated.properties index aea8b81..ae267de 100644 --- a/.mvn/repository/org/apache/maven/plugins/maven-resources-plugin/3.3.1/m2e-lastUpdated.properties +++ b/.mvn/repository/org/apache/maven/plugins/maven-resources-plugin/3.3.1/m2e-lastUpdated.properties @@ -1,2 +1,2 @@ -#Sun Feb 22 14:41:27 CST 2026 -central|https\://repo1.maven.org/maven2|null=1771742487363 +#Sun Feb 22 15:20:13 CST 2026 +central|https\://repo1.maven.org/maven2|null=1771744813432 diff --git a/.mvn/repository/org/apache/maven/plugins/maven-site-plugin/3.12.1/m2e-lastUpdated.properties b/.mvn/repository/org/apache/maven/plugins/maven-site-plugin/3.12.1/m2e-lastUpdated.properties index 2695045..8ec82e0 100644 --- a/.mvn/repository/org/apache/maven/plugins/maven-site-plugin/3.12.1/m2e-lastUpdated.properties +++ b/.mvn/repository/org/apache/maven/plugins/maven-site-plugin/3.12.1/m2e-lastUpdated.properties @@ -1,2 +1,2 @@ -#Sun Feb 22 14:41:27 CST 2026 -central|https\://repo1.maven.org/maven2|null=1771742487400 +#Sun Feb 22 15:20:13 CST 2026 +central|https\://repo1.maven.org/maven2|null=1771744813443 diff --git a/.mvn/repository/org/apache/maven/plugins/maven-surefire-plugin/3.1.2/m2e-lastUpdated.properties b/.mvn/repository/org/apache/maven/plugins/maven-surefire-plugin/3.1.2/m2e-lastUpdated.properties index 93a75af..8c123af 100644 --- a/.mvn/repository/org/apache/maven/plugins/maven-surefire-plugin/3.1.2/m2e-lastUpdated.properties +++ b/.mvn/repository/org/apache/maven/plugins/maven-surefire-plugin/3.1.2/m2e-lastUpdated.properties @@ -1,2 +1,2 @@ -#Sun Feb 22 14:41:27 CST 2026 -central|https\://repo1.maven.org/maven2|null=1771742487372 +#Sun Feb 22 15:20:13 CST 2026 +central|https\://repo1.maven.org/maven2|null=1771744813439 diff --git a/.mvn/repository/org/springframework/boot/spring-boot-maven-plugin/3.2.0/m2e-lastUpdated.properties b/.mvn/repository/org/springframework/boot/spring-boot-maven-plugin/3.2.0/m2e-lastUpdated.properties index 4b240ee..47ae764 100644 --- a/.mvn/repository/org/springframework/boot/spring-boot-maven-plugin/3.2.0/m2e-lastUpdated.properties +++ b/.mvn/repository/org/springframework/boot/spring-boot-maven-plugin/3.2.0/m2e-lastUpdated.properties @@ -1,2 +1,2 @@ -#Sun Feb 22 14:41:27 CST 2026 -central|https\://repo1.maven.org/maven2|null=1771742487376 +#Sun Feb 22 15:20:13 CST 2026 +central|https\://repo1.maven.org/maven2|null=1771744813440 diff --git a/fund-cust/src/main/resources/application.yml b/fund-cust/src/main/resources/application.yml index 315bb93..732d114 100644 --- a/fund-cust/src/main/resources/application.yml +++ b/fund-cust/src/main/resources/application.yml @@ -25,8 +25,8 @@ spring: password: ${DB_PASSWORD:zjf@123456} hikari: maximum-pool-size: 10 - minimum-idle: 5 - connection-timeout: 30000 + minimum-idle: ${HIKARI_MINIMUM_IDLE:5} + connection-timeout: ${HIKARI_CONNECTION_TIMEOUT:30000} mybatis-plus: mapper-locations: classpath*:/mapper/**/*.xml diff --git a/fund-exp/src/main/resources/application.yml b/fund-exp/src/main/resources/application.yml index e8fd70f..bf44010 100644 --- a/fund-exp/src/main/resources/application.yml +++ b/fund-exp/src/main/resources/application.yml @@ -24,8 +24,8 @@ spring: password: ${DB_PASSWORD:zjf@123456} hikari: maximum-pool-size: 10 - minimum-idle: 5 - connection-timeout: 30000 + minimum-idle: ${HIKARI_MINIMUM_IDLE:5} + connection-timeout: ${HIKARI_CONNECTION_TIMEOUT:30000} mybatis-plus: mapper-locations: classpath*:/mapper/**/*.xml diff --git a/fund-file/src/main/resources/application.yml b/fund-file/src/main/resources/application.yml index 0712580..1a80450 100644 --- a/fund-file/src/main/resources/application.yml +++ b/fund-file/src/main/resources/application.yml @@ -24,12 +24,12 @@ spring: # 文件上传配置 servlet: multipart: - max-file-size: 50MB - max-request-size: 100MB + max-file-size: ${FILE_UPLOAD_MAX_SIZE:50MB} + max-request-size: ${FILE_UPLOAD_MAX_REQUEST_SIZE:100MB} # 腾讯云COS配置 cos: - enabled: true + enabled: ${COS_ENABLED:true} secret-id: ${COS_SECRET_ID:AKIDukKfkY5LK2SbU6QTM7csugCSSDjzyiDS} secret-key: ${COS_SECRET_KEY:0lHXYIn20jDRP7ZlhNnyub3GEwObZHjw} bucket: ${COS_BUCKET:test-1308258046} @@ -39,8 +39,8 @@ cos: # 本地文件存储配置(备用) file: upload: - path: ./uploads - max-size: 52428800 + path: ${FILE_STORAGE_PATH:./uploads} + max-size: ${FILE_STORAGE_MAX_BYTES:52428800} logging: level: diff --git a/fund-gateway/src/main/resources/application.yml b/fund-gateway/src/main/resources/application.yml index a0927d9..71f4ce2 100644 --- a/fund-gateway/src/main/resources/application.yml +++ b/fund-gateway/src/main/resources/application.yml @@ -29,8 +29,8 @@ spring: # Sentinel配置 sentinel: transport: - dashboard: localhost:8080 # Sentinel Dashboard地址(可选) - port: 8719 # Sentinel客户端端口 + dashboard: ${SENTINEL_DASHBOARD:localhost:8080} + port: ${SENTINEL_PORT:8719} eager: true # 服务启动时立即初始化 # 负载均衡配置 @@ -44,8 +44,8 @@ spring: default-filters: - name: RequestRateLimiter args: - redis-rate-limiter.replenishRate: 100 # 每秒补充令牌数 - redis-rate-limiter.burstCapacity: 200 # 令牌桶最大容量 + redis-rate-limiter.replenishRate: ${GATEWAY_RATE_LIMIT_REPLENISH_RATE:100} + redis-rate-limiter.burstCapacity: ${GATEWAY_RATE_LIMIT_BURST_CAPACITY:200} key-resolver: "#{@ipKeyResolver}" # 全局跨域配置 diff --git a/fund-proj/src/main/resources/application.yml b/fund-proj/src/main/resources/application.yml index 646e0ce..aa5caab 100644 --- a/fund-proj/src/main/resources/application.yml +++ b/fund-proj/src/main/resources/application.yml @@ -24,8 +24,8 @@ spring: password: ${DB_PASSWORD:zjf@123456} hikari: maximum-pool-size: 10 - minimum-idle: 5 - connection-timeout: 30000 + minimum-idle: ${HIKARI_MINIMUM_IDLE:5} + connection-timeout: ${HIKARI_CONNECTION_TIMEOUT:30000} mybatis-plus: mapper-locations: classpath*:/mapper/**/*.xml diff --git a/fund-receipt/src/main/resources/application.yml b/fund-receipt/src/main/resources/application.yml index 254e4b2..1d8ddd4 100644 --- a/fund-receipt/src/main/resources/application.yml +++ b/fund-receipt/src/main/resources/application.yml @@ -24,8 +24,8 @@ spring: password: ${DB_PASSWORD:zjf@123456} hikari: maximum-pool-size: 10 - minimum-idle: 5 - connection-timeout: 30000 + minimum-idle: ${HIKARI_MINIMUM_IDLE:5} + connection-timeout: ${HIKARI_CONNECTION_TIMEOUT:30000} mybatis-plus: mapper-locations: classpath*:/mapper/**/*.xml diff --git a/fund-req/src/main/resources/application.yml b/fund-req/src/main/resources/application.yml index b709b7a..fbef340 100644 --- a/fund-req/src/main/resources/application.yml +++ b/fund-req/src/main/resources/application.yml @@ -24,8 +24,8 @@ spring: password: ${DB_PASSWORD:zjf@123456} hikari: maximum-pool-size: 10 - minimum-idle: 5 - connection-timeout: 30000 + minimum-idle: ${HIKARI_MINIMUM_IDLE:5} + connection-timeout: ${HIKARI_CONNECTION_TIMEOUT:30000} mybatis-plus: mapper-locations: classpath*:/mapper/**/*.xml diff --git a/fund-sys/src/main/resources/application.yml b/fund-sys/src/main/resources/application.yml index e0a9b4b..b6283b8 100644 --- a/fund-sys/src/main/resources/application.yml +++ b/fund-sys/src/main/resources/application.yml @@ -46,13 +46,13 @@ spring: port: ${REDIS_PORT:6379} password: ${REDIS_PASSWORD:zjf@123456} database: ${REDIS_DATABASE:0} - timeout: 10000 + timeout: ${REDIS_TIMEOUT:10000} lettuce: pool: - max-active: 8 - max-wait: -1 - max-idle: 8 - min-idle: 0 + max-active: ${REDIS_POOL_MAX_ACTIVE:8} + max-wait: ${REDIS_POOL_MAX_WAIT:-1} + max-idle: ${REDIS_POOL_MAX_IDLE:8} + min-idle: ${REDIS_POOL_MIN_IDLE:0} mybatis-plus: mapper-locations: classpath*:/mapper/**/*.xml diff --git a/scripts/env.properties b/scripts/env.properties index 69dd8b1..43d93c7 100644 --- a/scripts/env.properties +++ b/scripts/env.properties @@ -19,6 +19,47 @@ REDIS_HOST=localhost REDIS_PORT=6379 REDIS_PASSWORD=zjf@123456 REDIS_DATABASE=0 +REDIS_TIMEOUT=10000 +REDIS_POOL_MAX_ACTIVE=8 +REDIS_POOL_MAX_WAIT=-1 +REDIS_POOL_MAX_IDLE=8 +REDIS_POOL_MIN_IDLE=0 + +# -------------------------------------------- +# Hikari连接池配置(公共) +# -------------------------------------------- +HIKARI_MINIMUM_IDLE=5 +HIKARI_CONNECTION_TIMEOUT=30000 + +# -------------------------------------------- +# Sentinel配置(Gateway使用) +# -------------------------------------------- +SENTINEL_DASHBOARD=localhost:8080 +SENTINEL_PORT=8719 + +# -------------------------------------------- +# 网关限流配置 +# -------------------------------------------- +GATEWAY_RATE_LIMIT_REPLENISH_RATE=100 +GATEWAY_RATE_LIMIT_BURST_CAPACITY=200 + +# -------------------------------------------- +# 腾讯云COS配置(文件服务使用) +# -------------------------------------------- +COS_ENABLED=true +COS_SECRET_ID=AKIDukKfkY5LK2SbU6QTM7csugCSSDjzyiDS +COS_SECRET_KEY=0lHXYIn20jDRP7ZlhNnyub3GEwObZHjw +COS_BUCKET=test-1308258046 +COS_REGION=ap-beijing +COS_BUCKET_HOST=https://test-1308258046.cos.ap-beijing.myqcloud.com + +# -------------------------------------------- +# 文件上传配置 +# -------------------------------------------- +FILE_UPLOAD_MAX_SIZE=50MB +FILE_UPLOAD_MAX_REQUEST_SIZE=100MB +FILE_STORAGE_PATH=./uploads +FILE_STORAGE_MAX_BYTES=52428800 # -------------------------------------------- # 日志配置