refactor(config): 重构应用配置文件结构
- 将application.yml中的配置项按环境分离到对应配置文件 - 在application-dev.yml中添加服务器和应用配置 - 在application-prod.yml中添加生产环境支付配置 - 在application-test.yml中添加测试环境支付配置 - 删除application-paypal-example.yml示例文件 - 在主应用类中启用PingPong配置属性支持 - 更新配置文件激活方式为profiles模式
This commit is contained in:
@@ -1,12 +1,15 @@
|
||||
package com.mtkj.mtpay;
|
||||
|
||||
import com.mtkj.mtpay.config.PingPongProperties;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.core.env.Environment;
|
||||
|
||||
@Slf4j
|
||||
@SpringBootApplication
|
||||
@EnableConfigurationProperties({PingPongProperties.class})
|
||||
public class MtPayApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
@@ -60,10 +60,44 @@ spring:
|
||||
config:
|
||||
multi-statement-allow: true
|
||||
|
||||
|
||||
# 服务器配置(所有环境通用)
|
||||
server:
|
||||
port: 8082
|
||||
servlet:
|
||||
context-path: /
|
||||
# 文件上传配置
|
||||
multipart:
|
||||
# 单个文件最大大小(10MB)
|
||||
max-file-size: 10MB
|
||||
# 请求最大大小(50MB,支持多文件上传)
|
||||
max-request-size: 50MB
|
||||
# 文件写入磁盘的阈值(超过此大小会写入临时文件)
|
||||
file-size-threshold: 2MB
|
||||
|
||||
# 应用配置(所有环境通用)
|
||||
app:
|
||||
# 前端访问地址(用于生成商品详情页URL等)
|
||||
frontend:
|
||||
url: http://localhost:3000
|
||||
|
||||
# 阿里云OSS相关配置(所有环境通用)
|
||||
aliyun:
|
||||
oss:
|
||||
accessId: LTAI5tHbwvzWfANvNxju2yN1
|
||||
accessKey: sAQR2swByBgmMOofH97hSJT638aVcJ
|
||||
endpoint: https://oss-cn-hangzhou.aliyuncs.com
|
||||
bucketName: mtkj2025
|
||||
|
||||
# PingPong支付配置(开发环境使用沙箱)
|
||||
pingpong:
|
||||
client-id: your-client-id
|
||||
acc-id: your-acc-id
|
||||
secret: your-secret-key
|
||||
sign-type: MD5
|
||||
gateway: https://sandbox-acquirer-payment.pingpongx.com
|
||||
mode: sandbox
|
||||
enabled: false
|
||||
|
||||
# PayPal支付配置(开发环境使用沙箱)
|
||||
paypal:
|
||||
@@ -76,3 +110,4 @@ paypal:
|
||||
# 是否启用PayPal支付
|
||||
enabled: true
|
||||
|
||||
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
# PayPal支付配置示例
|
||||
# 请将以下配置添加到你的application.yml或application-dev.yml中
|
||||
|
||||
paypal:
|
||||
# PayPal Client ID(从PayPal开发者控制台获取)
|
||||
client-id: YOUR_CLIENT_ID
|
||||
# PayPal Client Secret(从PayPal开发者控制台获取)
|
||||
client-secret: YOUR_CLIENT_SECRET
|
||||
# 环境模式:sandbox(沙箱)或 production(生产)
|
||||
mode: sandbox
|
||||
# 是否启用PayPal支付
|
||||
enabled: true
|
||||
|
||||
@@ -62,6 +62,22 @@ spring:
|
||||
|
||||
# PingPong支付配置(生产环境)
|
||||
pingpong:
|
||||
client-id: ${pingpong.client-id}
|
||||
acc-id: ${pingpong.acc-id}
|
||||
secret: ${pingpong.secret}
|
||||
sign-type: MD5
|
||||
gateway: https://acquirer-payment.pingpongx.com
|
||||
mode: build
|
||||
enabled: false
|
||||
|
||||
# PayPal支付配置(生产环境)
|
||||
paypal:
|
||||
# PayPal Client ID(API密钥)- 从环境变量或配置中心获取
|
||||
client-id: AdGYUZpvLuHR30dybOApvM-RNB1pVKtd74SVfh-6TK52xV-1JEBddHVMCWuDdyyHri4DXd4kABBi7Icb
|
||||
# PayPal Client Secret(密钥)- 从环境变量或配置中心获取
|
||||
client-secret: ENblspyRmwsOU_PWFurlhEYUF5Da6aYKl0pjK4ehm7p3R5aSqvbpaF_YsIIs8v0ty1c9WJu15XP-Fe_1
|
||||
# 环境模式:sandbox(沙箱)或 production(生产)
|
||||
mode: sandbox
|
||||
# 是否启用PayPal支付
|
||||
enabled: true
|
||||
|
||||
|
||||
@@ -62,6 +62,21 @@ spring:
|
||||
|
||||
# PingPong支付配置(测试环境)
|
||||
pingpong:
|
||||
client-id: ${pingpong.client-id}
|
||||
acc-id: ${pingpong.acc-id}
|
||||
secret: ${pingpong.secret}
|
||||
sign-type: MD5
|
||||
gateway: https://sandbox-acquirer-payment.pingpongx.com
|
||||
mode: test
|
||||
enabled: false
|
||||
|
||||
# PayPal支付配置(测试环境)
|
||||
paypal:
|
||||
# PayPal Client ID(API密钥)
|
||||
client-id: AdGYUZpvLuHR30dybOApvM-RNB1pVKtd74SVfh-6TK52xV-1JEBddHVMCWuDdyyHri4DXd4kABBi7Icb
|
||||
# PayPal Client Secret(密钥)
|
||||
client-secret: ENblspyRmwsOU_PWFurlhEYUF5Da6aYKl0pjK4ehm7p3R5aSqvbpaF_YsIIs8v0ty1c9WJu15XP-Fe_1
|
||||
# 环境模式:sandbox(沙箱)或 production(生产)
|
||||
mode: sandbox
|
||||
# 是否启用PayPal支付
|
||||
enabled: true
|
||||
|
||||
@@ -1,99 +1,5 @@
|
||||
spring:
|
||||
application:
|
||||
name: mt-pay
|
||||
datasource:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
druid:
|
||||
# 从库数据源
|
||||
slave:
|
||||
# 从数据源开关/默认关闭
|
||||
enabled: false
|
||||
url:
|
||||
username:
|
||||
password:
|
||||
# Druid监控配置
|
||||
web-stat-filter:
|
||||
enabled: true
|
||||
stat-view-servlet:
|
||||
enabled: true
|
||||
# 设置白名单,不填则允许所有访问
|
||||
allow:
|
||||
url-pattern: /druid/*
|
||||
# 控制台管理用户名和密码
|
||||
login-username: ruoyi
|
||||
login-password: 123456
|
||||
filter:
|
||||
stat:
|
||||
enabled: true
|
||||
# 慢SQL记录
|
||||
log-slow-sql: false
|
||||
slow-sql-millis: 1000
|
||||
merge-sql: true
|
||||
wall:
|
||||
config:
|
||||
multi-statement-allow: true
|
||||
# MyBatis-Plus配置
|
||||
mybatis-plus:
|
||||
# 配置扫描mapper.xml文件路径
|
||||
mapper-locations: classpath*:/mapper/**/*.xml
|
||||
# 配置实体类包路径
|
||||
type-aliases-package: com.mtkj.mtpay.entity
|
||||
# 配置MyBatis-Plus全局配置
|
||||
configuration:
|
||||
# 开启驼峰命名转换
|
||||
map-underscore-to-camel-case: true
|
||||
# 开启二级缓存
|
||||
cache-enabled: false
|
||||
# 日志实现
|
||||
log-impl: org.apache.ibatis.logging.slf4j.Slf4jImpl
|
||||
# 全局配置
|
||||
global-config:
|
||||
db-config:
|
||||
# 主键类型:AUTO-数据库自增
|
||||
id-type: auto
|
||||
# 逻辑删除字段
|
||||
logic-delete-field: deleted
|
||||
# 逻辑删除值
|
||||
logic-delete-value: 1
|
||||
# 逻辑未删除值
|
||||
logic-not-delete-value: 0
|
||||
profiles:
|
||||
active: dev
|
||||
|
||||
# PingPong支付配置
|
||||
pingpong:
|
||||
client-id: your-client-id
|
||||
acc-id: your-acc-id
|
||||
secret: your-secret-key
|
||||
sign-type: MD5
|
||||
gateway: https://sandbox-acquirer-payment.pingpongx.com
|
||||
mode: sandbox
|
||||
enabled: true
|
||||
|
||||
# 服务器配置
|
||||
server:
|
||||
port: 8082
|
||||
servlet:
|
||||
context-path: /
|
||||
# 文件上传配置
|
||||
multipart:
|
||||
# 单个文件最大大小(10MB)
|
||||
max-file-size: 10MB
|
||||
# 请求最大大小(50MB,支持多文件上传)
|
||||
max-request-size: 50MB
|
||||
# 文件写入磁盘的阈值(超过此大小会写入临时文件)
|
||||
file-size-threshold: 2MB
|
||||
|
||||
# 应用配置
|
||||
app:
|
||||
# 前端访问地址(用于生成商品详情页URL等)
|
||||
frontend:
|
||||
url: http://localhost:3000
|
||||
|
||||
# 阿里云OSS相关配置
|
||||
aliyun:
|
||||
oss:
|
||||
accessId: LTAI5tHbwvzWfANvNxju2yN1
|
||||
accessKey: sAQR2swByBgmMOofH97hSJT638aVcJ
|
||||
endpoint: https://oss-cn-hangzhou.aliyuncs.com
|
||||
bucketName: mtkj2025
|
||||
|
||||
|
||||
Reference in New Issue
Block a user