mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2024-06-07 19:40:43 +00:00
feat: add COPY_CONFIG_DEST option (#689)
This commit is contained in:
parent
9d68fa3b88
commit
ca9f883352
@ -309,6 +309,10 @@ This works well if you want to have a common set of modules in a separate
|
|||||||
location, but still have multiple worlds with different server requirements
|
location, but still have multiple worlds with different server requirements
|
||||||
in either persistent volumes or a downloadable archive.
|
in either persistent volumes or a downloadable archive.
|
||||||
|
|
||||||
|
You can specify the destination of the configs that are located inside the `/config` mount by setting the `COPY_CONFIG_DEST` variable. The configs are copied recursivly to the `/data/config` directory by default. If a file was updated directly inside the `/data/*` directoy and is newer than the file in the `/config/*` mount it will not be overriden.
|
||||||
|
|
||||||
|
> For example: `-v ./config:/config -e COPY_CONFIG_DEST=/data` will allow you to copy over your `bukkit.yml` and so on directly into the server directory.
|
||||||
|
|
||||||
### Replacing variables inside configs
|
### Replacing variables inside configs
|
||||||
|
|
||||||
Sometimes you have mods or plugins that require configuration information that is only available at runtime.
|
Sometimes you have mods or plugins that require configuration information that is only available at runtime.
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
. ${SCRIPTS:-/}start-utils
|
. ${SCRIPTS:-/}start-utils
|
||||||
|
|
||||||
|
: ${COPY_CONFIG_DEST:="/data/config"}
|
||||||
|
|
||||||
if [ -n "$OPS" ]; then
|
if [ -n "$OPS" ]; then
|
||||||
log "Setting/adding ops"
|
log "Setting/adding ops"
|
||||||
rm -rf /data/ops.txt.converted
|
rm -rf /data/ops.txt.converted
|
||||||
@ -57,14 +59,11 @@ if [ -d /mods ]; then
|
|||||||
rsync -a --out-format="update:%f:Last Modified %M" "${rsyncArgs[@]}" --prune-empty-dirs --update /mods /data
|
rsync -a --out-format="update:%f:Last Modified %M" "${rsyncArgs[@]}" --prune-empty-dirs --update /mods /data
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ -d /data/config ] || mkdir /data/config
|
if [ -d /config ]; then
|
||||||
for c in /config/*
|
log "Copying any configs from /config to $COPY_CONFIG_DEST"
|
||||||
do
|
mkdir -p $COPY_CONFIG_DEST
|
||||||
if [ -f "$c" ]; then
|
rsync -a --out-format="update:%f:Last Modified %M" "${rsyncArgs[@]}" --prune-empty-dirs --update /config/ $COPY_CONFIG_DEST
|
||||||
log Copying configuration $(basename "$c")
|
fi
|
||||||
cp -rf "$c" /data/config
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
EXTRA_ARGS=""
|
EXTRA_ARGS=""
|
||||||
# Optional disable console
|
# Optional disable console
|
||||||
|
Loading…
Reference in New Issue
Block a user