修复工作

This commit is contained in:
2025-09-30 20:10:34 +08:00
parent 8f4e25e895
commit e77a2f7cff
3 changed files with 17 additions and 4 deletions

View File

@@ -59,8 +59,17 @@ public class InitServer implements CommandLineRunner {
public void run(String... args) throws Exception {
// 初始化自动播放
this.initAutoPlay();
// TODO 获取本机IP地址
String ip = "localhost";
// 获取服务器IP地址支持环境变量配置
String ip = System.getenv("SERVER_HOST");
if (StrUtil.isEmpty(ip)) {
try {
// 尝试获取本机IP
InetAddress addr = InetAddress.getLocalHost();
ip = addr.getHostAddress();
} catch (Exception e) {
ip = "localhost";
}
}
// 获取http端口号
String httpPort = this.env.getProperty("server.port");
// 获取web路径