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(