Merge pull request #5204 from uweschaefer/master

* pr/5204:
  Polish contribution
  Add CONF_FOLDER property
This commit is contained in:
Stephane Nicoll 2016-02-29 11:42:38 +01:00
commit 1ca9cdabf7
2 changed files with 11 additions and 3 deletions

View File

@ -571,6 +571,9 @@ the default behavior in a script or on the command line:
|`LOG_FOLDER`
|The name of the folder to put log files in (`/var/log` by default).
|`CONF_FOLDER`
|The name of the folder to read .conf files from (same folder as jar-file by default).
|`LOG_FILENAME`
|The name of the log file in the `LOG_FOLDER` (`<appname>.log` by default).
@ -654,9 +657,10 @@ a `.conf` file,
LOG_FOLDER=/custom/log/folder
----
The file should be situated next to the jar file and have the same name but suffixed with
The file is expected next to the jar file and have the same name but suffixed with
`.conf` rather than `.jar`. For example, a jar named `/var/myapp/myapp.jar` will use the
configuration file named `/var/myapp/myapp.conf` if it exists.
configuration file named `/var/myapp/myapp.conf` if it exists. You can also use the
`CONF_FOLDER` property to customize the location of that file.
To learn about securing this file appropriately, please refer to
<<deployment-initd-service-securing,the guidelines for securing an init.d service>>.

View File

@ -42,8 +42,12 @@ cd "$WORKING_DIR" || exit 1
# Source any config file
configfile="$(basename "${jarfile%.*}.conf")"
# Initialize CONF_FOLDER location defaulting to jarfolder
[[ -z "$CONF_FOLDER" ]] && CONF_FOLDER="${jarfolder}"
# shellcheck source=/dev/null
[[ -r "${jarfolder}/${configfile}" ]] && source "${jarfolder}/${configfile}"
[[ -r "${CONF_FOLDER}/${configfile}" ]] && source "${CONF_FOLDER}/${configfile}"
# Initialize PID/LOG locations if they weren't provided by the config file
[[ -z "$PID_FOLDER" ]] && PID_FOLDER="{{pidFolder:/var/run}}"