docs(config): 添加配置文件管理说明并调整开发环境配置

- 创建 CONFIG_MANAGEMENT.md 详细说明配置文件结构和管理规范
- 为 mt-pay 和 mt-startup 模块分别创建生产环境配置文件
- 将前端访问地址从生产域名改为开发环境本地地址
- 更新 PayPal Webhook 配置为开发环境内网穿透地址
- 调整应用启动时的访问地址提示信息
- 优化数据库连接和服务器配置的环境变量支持
This commit is contained in:
2025-12-26 16:05:53 +08:00
parent 07dcd9408c
commit 504ccabba1
9 changed files with 362 additions and 109 deletions

View File

@@ -32,9 +32,9 @@ public class MtPayApplication {
String contextPath = env.getProperty("server.servlet.context-path", "");
String activeProfiles = String.join(",", env.getActiveProfiles());
// 构建完整的访问地址(使用域名)
String serverHost = env.getProperty("app.server.host", "shopd.mtkj2025.com");
String protocol = env.getProperty("app.server.protocol", "https");
// 构建完整的访问地址(开发环境使用localhost生产环境使用配置的域名)
String serverHost = env.getProperty("app.server.host", "localhost");
String protocol = env.getProperty("app.server.protocol", "http");
String baseUrl = protocol + "://" + serverHost + ":" + serverPort + contextPath;
String apiUrl = baseUrl + "/api";
String druidUrl = baseUrl + "/druid";
@@ -73,7 +73,7 @@ public class MtPayApplication {
log.info("""
📌 提示:
- 前端地址: https://shopd.mtkj2025.com
- 前端代理地址: http://localhost:3000
- 后端API地址: {}
- 图片上传接口: {}/product/upload/image
- 商品管理接口: {}/product

View File

@@ -25,7 +25,7 @@ public class ProductLinkServiceImpl implements ProductLinkService {
@Autowired
private MtProductLinkMapper productLinkMapper;
@Value("${app.frontend.url:https://shopd.mtkj2025.com}")
@Value("${app.frontend.url:http://localhost:3000}")
private String frontendUrl;
private static final int DEFAULT_EXPIRE_DAYS = 90;

View File

@@ -72,7 +72,7 @@ public class ProductServiceImpl implements ProductService {
/**
* 前端访问地址用于生成商品详情页URL
*/
@Value("${app.frontend.url:https://shopd.mtkj2025.com}")
@Value("${app.frontend.url:http://localhost:3000}")
private String frontendUrl;
/**
@@ -858,7 +858,8 @@ public class ProductServiceImpl implements ProductService {
/**
* 从完整URL中提取链接码
* 支持两种输入:
* 1. 完整URLhttps://shopd.mtkj2025.com/product/2563c74bd94c4a4b95abccf697a6c756
* 1. 完整URLhttp://localhost:3000/product/2563c74bd94c4a4b95abccf697a6c756(开发环境)
* 或 https://shopd.mtkj2025.com/product/2563c74bd94c4a4b95abccf697a6c756生产环境
* 2. 链接码2563c74bd94c4a4b95abccf697a6c756
*
* @param input 用户输入的URL或链接码

View File

@@ -75,12 +75,11 @@ server:
# 文件写入磁盘的阈值(超过此大小会写入临时文件)
file-size-threshold: 2MB
# 应用配置(所有环境通用
# 应用配置(开发环境
app:
# 前端访问地址(用于生成商品详情页URL等
# 注意已配置SSL证书使用HTTPS和域名
# 前端访问地址(开发环境使用localhost
frontend:
url: https://shopd.mtkj2025.com
url: http://localhost:3000
# 阿里云OSS相关配置所有环境通用
aliyun:
@@ -112,10 +111,11 @@ paypal:
mode: sandbox
# 是否启用PayPal支付
enabled: true
# Webhook URL服务器公网地址必须使用HTTPS端口443
# Webhook URL开发环境使用内网穿透或测试地址
# 注意PayPal只接受HTTPS端口443的Webhook URL
# 已配置SSL证书使用域名访问
webhook-url: https://shopd.mtkj2025.com/api/paypal/webhook
# 开发环境可以使用内网穿透服务如ngrok、cpolar或留空
# 生产环境需要在application-prod.yml中配置
webhook-url: https://2646b437.r33.cpolar.top/api/paypal/webhook
# Webhook ID从PayPal控制台获取用于验证Webhook签名
webhook-id: 0SX6117212808615P