From 6de3f02171d57a7f41448f6e154cd7625f02d632 Mon Sep 17 00:00:00 2001 From: FatttSnake Date: Mon, 9 Oct 2023 16:52:57 +0800 Subject: [PATCH] Optimize profiles path in docker --- Dockerfile | 2 +- src/main/kotlin/top/fatweb/api/FatWebApiApplication.kt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 957b824..5f96fac 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,4 +10,4 @@ COPY ${EXTRACTED}/snapshot-dependencies/ / RUN true COPY ${EXTRACTED}/application/ / -ENTRYPOINT ["java", "org.springframework.boot.loader.JarLauncher", "${JAVA_OPTS}"] \ No newline at end of file +ENTRYPOINT ["java", "org.springframework.boot.loader.JarLauncher", "--spring.config.additional-location=file:data/", "${JAVA_OPTS}"] \ No newline at end of file diff --git a/src/main/kotlin/top/fatweb/api/FatWebApiApplication.kt b/src/main/kotlin/top/fatweb/api/FatWebApiApplication.kt index 3c635e2..a2d2e01 100644 --- a/src/main/kotlin/top/fatweb/api/FatWebApiApplication.kt +++ b/src/main/kotlin/top/fatweb/api/FatWebApiApplication.kt @@ -21,10 +21,10 @@ fun main(args: Array) { } } - if (File("application-config.yml").exists()) { + if (File("application-config.yml").exists() || File("data/application-config.yml").exists()) { runApplication(*args) } else { - logger.warn("File ‘application.yml’ cannot be found in the running path. The configuration file template 'application.example.yml' has been created in directory 'data'. Please change the configuration file content, rename it to 'application.yml' and put it in the running path, and then restart the server.") + logger.warn("File ‘application.yml’ cannot be found in the running path. The configuration file template 'application.example.yml' has been created in directory 'data'. Please change the configuration file content, rename it to 'application.yml', and then restart the server.") FatWebApiApplication::class.java.getResource("/application-config-template.yml")?.readText()?.let { File("data/application-config.example.yml").writeText( it.replace(