Skip to content

Commit d73d3fe

Browse files
committed
#Support original file name even if it is a symbolic link [http://stackoverflow.com/questions/43584510/conf-file-for-spring-boot-application](config file) this is needed if your systemd or init.d is pointing to a symbolic link file instead of the original fat jar
1 parent c2e5fd0 commit d73d3fe

File tree

1 file changed

+3
-1
lines changed
  • spring-boot-tools/spring-boot-loader-tools/src/main/resources/org/springframework/boot/loader/tools

1 file changed

+3
-1
lines changed

spring-boot-tools/spring-boot-loader-tools/src/main/resources/org/springframework/boot/loader/tools/launch.script

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ WORKING_DIR="$(pwd)"
3131
# Follow symlinks to find the real jar and detect init.d script
3232
cd "$(dirname "$0")" || exit 1
3333
[[ -z "$jarfile" ]] && jarfile=$(pwd)/$(basename "$0")
34+
originalconfigfile="$(basename "${jarfile%.*}.conf")"
3435
while [[ -L "$jarfile" ]]; do
3536
[[ "$jarfile" =~ init\.d ]] && init_script=$(basename "$jarfile")
3637
jarfile=$(readlink "$jarfile")
@@ -47,7 +48,8 @@ configfile="$(basename "${jarfile%.*}.conf")"
4748
[[ -z "$CONF_FOLDER" ]] && CONF_FOLDER="{{confFolder:${jarfolder}}}"
4849

4950
# shellcheck source=/dev/null
50-
[[ -r "${CONF_FOLDER}/${configfile}" ]] && source "${CONF_FOLDER}/${configfile}"
51+
[[ -r "${CONF_FOLDER}/${originalconfigfile}" ]] && source "${CONF_FOLDER}/${originalconfigfile}"
52+
[[ ! -r "${CONF_FOLDER}/${originalconfigfile}" ]] && [[ -r "${CONF_FOLDER}/${configfile}" ]] && source "${CONF_FOLDER}/${configfile}"
5153

5254
# Initialize PID/LOG locations if they weren't provided by the config file
5355
[[ -z "$PID_FOLDER" ]] && PID_FOLDER="{{pidFolder:/var/run}}"

0 commit comments

Comments
 (0)