mirror of
https://github.com/qaiu/netdisk-fast-download.git
synced 2026-06-11 16:07:27 +00:00
fix: Deploy 启动时自动从 resources/ 子目录查找配置文件
当 app.yml 在当前目录不存在时,自动回退到 resources/app.yml, 解决 Docker 部署时配置文件在 resources/ 子目录导致启动失败的问题。
This commit is contained in:
@@ -16,6 +16,8 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
@@ -62,7 +64,12 @@ public final class Deploy {
|
||||
path.append("-").append(args[0].replace("app-",""));
|
||||
}
|
||||
|
||||
// 读取yml配置
|
||||
// 读取yml配置,优先当前目录,其次 resources/ 子目录
|
||||
String configFile = path + ".yml";
|
||||
if (!Files.exists(Path.of(configFile)) && Files.exists(Path.of("resources", configFile))) {
|
||||
path.insert(0, "resources/");
|
||||
LOGGER.info("从 resources/ 目录加载配置: {}", path + ".yml");
|
||||
}
|
||||
ConfigUtil.readYamlConfig(path.toString(), tempVertx)
|
||||
.onSuccess(this::readConf)
|
||||
.onFailure(err -> {
|
||||
|
||||
Reference in New Issue
Block a user