Optimize profiles path in docker

This commit is contained in:
2023-10-09 16:52:57 +08:00
parent e435fed9b2
commit 6de3f02171
2 changed files with 3 additions and 3 deletions

View File

@@ -10,4 +10,4 @@ COPY ${EXTRACTED}/snapshot-dependencies/ /
RUN true RUN true
COPY ${EXTRACTED}/application/ / COPY ${EXTRACTED}/application/ /
ENTRYPOINT ["java", "org.springframework.boot.loader.JarLauncher", "${JAVA_OPTS}"] ENTRYPOINT ["java", "org.springframework.boot.loader.JarLauncher", "--spring.config.additional-location=file:data/", "${JAVA_OPTS}"]

View File

@@ -21,10 +21,10 @@ fun main(args: Array<String>) {
} }
} }
if (File("application-config.yml").exists()) { if (File("application-config.yml").exists() || File("data/application-config.yml").exists()) {
runApplication<FatWebApiApplication>(*args) runApplication<FatWebApiApplication>(*args)
} else { } 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 { FatWebApiApplication::class.java.getResource("/application-config-template.yml")?.readText()?.let {
File("data/application-config.example.yml").writeText( File("data/application-config.example.yml").writeText(
it.replace( it.replace(