From 367f07b7842194dbb414edf508e1e772a434a1cb Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Thu, 4 Nov 2021 20:55:15 -0500 Subject: [PATCH] feat: added SKIP_SERVER_PROPERTIES #1108 --- README.md | 13 +++++------- scripts/start-setupServerProperties | 32 ++++++++++++++++------------- 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 66cd48d8..37e22c3e 100644 --- a/README.md +++ b/README.md @@ -796,18 +796,15 @@ The world will only be downloaded or copied if it doesn't exist already. Set `FO ## Server configuration -By default the server configuration will be created and set based on the following -environment variables, but only the first time the server is started. If the -`server.properties` file already exists, the values in them will not be changed. +By default, the server configuration will be created and set based on the following environment variables, but only the first time the server is started. If the `server.properties` file already exists, the values in them will not be changed. -If you would like to override the server configuration each time the container -starts up, you can set the OVERRIDE_SERVER_PROPERTIES environment variable like: +If you would like to override the server configuration each time the container starts up, you can set the `OVERRIDE_SERVER_PROPERTIES` environment variable like: docker run -d -e OVERRIDE_SERVER_PROPERTIES=true ... -This will reset any manual configuration of the `server.properties` file, so if -you want to make any persistent configuration changes you will need to make sure -you have properly set the proper environment variables in your docker run command (described below). +This will reset any manual configuration of the `server.properties` file, so if you want to make any persistent configuration changes you will need to make sure you have properly set the proper environment variables in your container configuration. + +In the opposite case, you can skip the startup script's creation of `server.properties`, by setting `SKIP_SERVER_PROPERTIES` to "true". ### Message of the Day diff --git a/scripts/start-setupServerProperties b/scripts/start-setupServerProperties index 50677d84..80931ec2 100755 --- a/scripts/start-setupServerProperties +++ b/scripts/start-setupServerProperties @@ -187,21 +187,25 @@ if [[ ${TYPE} == "CURSEFORGE" ]]; then log "detected FTB, changing properties path to ${SERVER_PROPERTIES}" fi -if [ ! -e "$SERVER_PROPERTIES" ]; then - log "Creating server.properties in ${SERVER_PROPERTIES}" - cp /tmp/server.properties "$SERVER_PROPERTIES" - customizeServerProps -elif [ -n "${OVERRIDE_SERVER_PROPERTIES}" ]; then - case ${OVERRIDE_SERVER_PROPERTIES^^} in - TRUE|1) - customizeServerProps - ;; - *) - log "server.properties already created, skipping" - ;; - esac +if ! isTrue "${SKIP_SERVER_PROPERTIES:-false}"; then + if [ ! -e "$SERVER_PROPERTIES" ]; then + log "Creating server.properties in ${SERVER_PROPERTIES}" + cp /tmp/server.properties "$SERVER_PROPERTIES" + customizeServerProps + elif [ -n "${OVERRIDE_SERVER_PROPERTIES}" ]; then + case ${OVERRIDE_SERVER_PROPERTIES^^} in + TRUE|1) + customizeServerProps + ;; + *) + log "server.properties already created, skipping" + ;; + esac + else + log "server.properties already created, skipping" + fi else - log "server.properties already created, skipping" + log "Skipping setup of server.properties" fi if isTrue "${ENABLE_AUTOPAUSE}"; then