Skip to content

Commit f1dd0f3

Browse files
authored
packwiz: re-load LOAD_ENV_FROM_FILE after the installer runs (#4137)
1 parent 292b2f7 commit f1dd0f3

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

docs/mods-and-plugins/packwiz.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ docker run -d --pull=always \
1313

1414
packwiz modpack definitions are processed before other mod definitions (`MODPACK`, `MODS`, etc.) to allow for additional processing/overrides you may want to perform (in case of mods not available via Modrinth/CurseForge, or you do not maintain the pack).
1515

16+
If the pack ships a `.env` file that you reference with `LOAD_ENV_FROM_FILE`, that file is re-loaded immediately after the packwiz installer runs, so the freshly downloaded values are applied to the remaining startup stages. Note that `TYPE` and `VERSION` are resolved earlier (before the deploy is dispatched), so a pack-provided `.env` cannot change those from within packwiz; use `LOAD_ENV_FROM_GENERIC_PACK` or `LOAD_ENV_FROM_ARCHIVE` for those.
17+
1618
!!! note
1719

1820
packwiz is pre-configured to only download server mods. If client-side mods are downloaded and cause issues, check your pack.toml configuration, and make sure any client-only mods are not set to `"both"`, but rather `"client"` for the side configuration item.

scripts/start-setupModpack

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,16 @@ function handlePackwiz() {
5050
logError "Failed to run packwiz installer"
5151
exit 1
5252
fi
53+
54+
# packwiz may have just downloaded/updated the env file referenced by
55+
# LOAD_ENV_FROM_FILE. The initial load in start-configuration happened
56+
# before this point, so re-load it now to pick up the pack's values for
57+
# the remaining setup stages (server.properties, JVM args, etc.).
58+
if [[ ${LOAD_ENV_FROM_FILE:-} ]]; then
59+
if ! loadEnvFromFile "${LOAD_ENV_FROM_FILE}"; then
60+
exit 1
61+
fi
62+
fi
5363
fi
5464
}
5565

0 commit comments

Comments
 (0)