docker
docker copied to clipboard
feat: set GEOSERVER_REQUIRE_FILE to currently used $GEOSERVER_DATA_DIR in startup.sh
There exists a problem where the default settings are copied over the existing geoserver data dir if a custom data dir is used.
If only GEOSERVER_DATA_DIR and neither SKIP_DEMO_DATA nor GEOSERVER_REQUIRE_FILE are set to any values. The GEOSERVER_REQUIRE_FILE will still be set to the default location because it is set in the Dockerfile and not in the startup script.
I assume that GEOSERVER_REQUIRE_FILE is not used outside the startup script is that correct?
The proposed solution here is one way to solve the issue without dropping the environment variable, but honestly as it is only used for checking if the demo data should be copied, I would suggest to drop the variable all together and rather do something like this:
## install release data directory if needed before starting tomcat
if [ "${SKIP_DEMO_DATA}" = "false" ] && [ ! -f "$GEOSERVER_DATA_DIR/global.xml" ]; then
echo "Initialize $GEOSERVER_DATA_DIR from data directory included in geoserver.war"
cp -r $CATALINA_HOME/webapps/geoserver/data/* $GEOSERVER_DATA_DIR
fi
instead of
## Skip demo data
if [ "${SKIP_DEMO_DATA}" = "true" ]; then
unset GEOSERVER_REQUIRE_FILE
elif [ -z "$GEOSERVER_REQUIRE_FILE" ]; then
export GEOSERVER_REQUIRE_FILE="$GEOSERVER_DATA_DIR/global.xml"
fi
## install release data directory if needed before starting tomcat
if [ ! -z "$GEOSERVER_REQUIRE_FILE" ] && [ ! -f "$GEOSERVER_REQUIRE_FILE" ]; then
echo "Initialize $GEOSERVER_DATA_DIR from data directory included in geoserver.war"
cp -r $CATALINA_HOME/webapps/geoserver/data/* $GEOSERVER_DATA_DIR
fi