Files
MTKJPAY/mt-pay/src/main/java/com/mtkj/mtpay/MtPayApplication.java
qiube a3633577b4 feat(config): 更新配置以支持HTTPS域名访问
- 将所有环境的前端URL从localhost和IP地址更新为https://shopd.mtkj2025.com
- 配置PayPal webhook使用HTTPS域名以满足PayPal安全要求
- 统一后端服务端口从18082调整为8082
- 更新Java代码中的默认URL配置和启动日志信息
- 创建域名配置、Nginx SSL配置和公网访问检查清单文档
- 为商品链接生成和API访问配置HTTPS协议支持
2025-12-26 15:18:34 +08:00

96 lines
6.0 KiB
Java

package com.mtkj.mtpay;
import com.mtkj.mtpay.config.BaiduTranslatorConfig;
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, BaiduTranslatorConfig.class})
public class MtPayApplication {
public static void main(String[] args) {
try {
log.info("""
╔══════════════════════════════════════════════════════════╗
║ ║
║ MTKJ PAY 支付系统正在启动... ║
║ ║
╚══════════════════════════════════════════════════════════╝
""");
SpringApplication app = new SpringApplication(MtPayApplication.class);
Environment env = app.run(args).getEnvironment();
String applicationName = env.getProperty("spring.application.name", "mt-pay");
String serverPort = env.getProperty("server.port", "8082");
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");
String baseUrl = protocol + "://" + serverHost + ":" + serverPort + contextPath;
String apiUrl = baseUrl + "/api";
String druidUrl = baseUrl + "/druid";
// 打印醒目的启动成功标识
log.info("""
╔══════════════════════════════════════════════════════════╗
║ ║
║ ✅ MTKJ PAY 支付系统启动成功! ✅ ║
║ ║
╠══════════════════════════════════════════════════════════╣
║ 应用信息 ║
╠══════════════════════════════════════════════════════════╣
║ 应用名称: {:<45} ║
║ 运行环境: {:<45} ║
║ 服务端口: {:<45} ║
╠══════════════════════════════════════════════════════════╣
║ 访问地址 ║
╠══════════════════════════════════════════════════════════╣
║ 后端服务: {:<45} ║
║ API接口: {:<45} ║
║ Druid监控: {:<45} ║
╠══════════════════════════════════════════════════════════╣
║ 状态: 🟢 服务运行中,可以接收请求 ║
╚══════════════════════════════════════════════════════════╝
""",
applicationName,
activeProfiles.isEmpty() ? "default" : activeProfiles,
serverPort,
baseUrl,
apiUrl,
druidUrl);
// 额外提示信息
log.info("""
📌 提示:
- 前端地址: https://shopd.mtkj2025.com
- 后端API地址: {}
- 图片上传接口: {}/product/upload/image
- 商品管理接口: {}/product
""", apiUrl, apiUrl, apiUrl);
} catch (Exception e) {
log.error("""
╔══════════════════════════════════════════════════════════╗
║ ║
║ ❌ MTKJ PAY 支付系统启动失败! ❌ ║
║ ║
╚══════════════════════════════════════════════════════════╝
""", e);
throw e;
}
}
}