Skip to content

Commit b7859d7

Browse files
authored
Added DOWNLOAD_EXTRA_CONFIGS (#3679)
1 parent c6cec63 commit b7859d7

File tree

3 files changed

+42
-2
lines changed

3 files changed

+42
-2
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
4848
--var version=${MC_SERVER_RUNNER_VERSION} --var app=mc-server-runner --file {{.app}} \
4949
--from ${GITHUB_BASEURL}/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz
5050

51-
ARG MC_HELPER_VERSION=1.48.14
51+
ARG MC_HELPER_VERSION=1.49.0
5252
ARG MC_HELPER_BASE_URL=${GITHUB_BASEURL}/itzg/mc-image-helper/releases/download/${MC_HELPER_VERSION}
5353
# used for cache busting local copy of mc-image-helper
5454
ARG MC_HELPER_REV=1

docs/configuration/misc-options.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
## Running with a custom server JAR
32

43
If you would like to run a custom server JAR, set `-e TYPE=CUSTOM` and pass the custom server
@@ -142,6 +141,37 @@ To enable support for optimized SIMD operations, the JVM flag can be set with th
142141

143142
SIMD optimized operations are supported by Pufferfish and Purpur.
144143

144+
## Downloading extra configuration files
145+
146+
You can download additional configuration files or other resources before the server starts by using the `DOWNLOAD_EXTRA_CONFIGS` environment variable. This is useful for downloading configs that you want to patch or modify during the startup process.
147+
148+
The format uses a `<` separator between the destination path and the source URL:
149+
150+
```
151+
DOWNLOAD_EXTRA_CONFIGS=destination<source_url[,destination2<source_url2,...]
152+
```
153+
154+
For example, to download configuration files for plugins:
155+
156+
```yaml
157+
environment:
158+
DOWNLOAD_EXTRA_CONFIGS: |
159+
plugins/WorldEdit<https://raw.githubusercontent.com/EngineHub/WorldEdit/refs/heads/version/7.3.x/worldedit-bukkit/src/main/resources/defaults/config.yml
160+
plugins/EssentialsX<https://raw.githubusercontent.com/EssentialsX/Essentials/refs/heads/2.x/Essentials/src/main/resources/config.yml
161+
```
162+
163+
Or as a single line:
164+
165+
```yaml
166+
environment:
167+
DOWNLOAD_EXTRA_CONFIGS: "plugins/WorldEdit<https://example.com/worldedit.yml,config<https://example.com/another.yml"
168+
```
169+
170+
The files will be downloaded to `/data/` relative paths, so `plugins/WorldEdit` will be saved as `/data/plugins/WorldEdit/config.yml`.
171+
172+
!!! note
173+
The downloaded files can be further processed using [environment variable replacement](interpolating.md) or [patch definitions](interpolating.md#patching-existing-files)
174+
145175
## Enable timestamps in init logs
146176

147177
Before the container starts the Minecraft Server its output is prefixed with `[init]`, such as

scripts/start-setupEnvVariables

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ handleDebugMode
1717
: "${DOWNLOAD_DEFAULTS:=}"
1818
: "${DOWNLOAD_DEFAULT_CONFIGS:=}"
1919
: "${SKIP_DOWNLOAD_DEFAULTS:=false}"
20+
: "${DOWNLOAD_EXTRA_CONFIGS:=}"
2021

2122
if isTrue "${REPLACE_ENV_IN_PLACE}"; then
2223
log "Replacing env variables in ${REPLACE_ENV_PATHS} that match the prefix '$REPLACE_ENV_VARIABLE_PREFIX' ..."
@@ -54,6 +55,15 @@ if isFalse "$SKIP_DOWNLOAD_DEFAULTS"; then
5455
fi
5556
fi
5657

58+
if [[ $DOWNLOAD_EXTRA_CONFIGS ]]; then
59+
mc-image-helper mcopy \
60+
--to /data \
61+
--skip-existing \
62+
--skip-up-to-date=false \
63+
--quiet-when-skipped \
64+
"$DOWNLOAD_EXTRA_CONFIGS"
65+
fi
66+
5767
if [[ ${PATCH_DEFINITIONS} ]]; then
5868
log "Applying patch definitions from ${PATCH_DEFINITIONS}"
5969
mc-image-helper patch \

0 commit comments

Comments
 (0)