diff --git a/docs/mods-and-plugins/curseforge-files.md b/docs/mods-and-plugins/curseforge-files.md index f0d64f29..886802de 100644 --- a/docs/mods-and-plugins/curseforge-files.md +++ b/docs/mods-and-plugins/curseforge-files.md @@ -6,7 +6,7 @@ A specific file can be omitted from each reference to allow for auto-selecting t !!! warning "CurseForge API key usage" - A CurseForge API key must be allocated and set with `CF_API_KEY` [as described here](../types-and-platforms/mod-platforms/auto-curseforge.md#api-key). + A CurseForge API key must be allocated and set with `CF_API_KEY` (or `CF_API_KEY_FILE`) [as described here](../types-and-platforms/mod-platforms/auto-curseforge.md#api-key). ## Project-file references diff --git a/docs/types-and-platforms/mod-platforms/auto-curseforge.md b/docs/types-and-platforms/mod-platforms/auto-curseforge.md index 3bbb0fea..c8c705c1 100644 --- a/docs/types-and-platforms/mod-platforms/auto-curseforge.md +++ b/docs/types-and-platforms/mod-platforms/auto-curseforge.md @@ -32,6 +32,19 @@ To manage a CurseForge modpack automatically with upgrade support, pinned or lat docker run --env-file=.env itzg/minecraft-server ``` + Alternately you can use [docker secrets](https://docs.docker.com/compose/how-tos/use-secrets/) with a `CF_API_KEY_FILE` environment variable: + ``` + service: + environment: + CF_API_KEY_FILE: /run/secrets/cf_api_key.secret + secrets: + - cf_api_key + + secrets: + cf_api_key: + file: cf_api_key.secret + ``` + !!! note Be sure to use the appropriate [image tag for the Java version compatible with the modpack](../../versions/java.md). diff --git a/docs/variables.md b/docs/variables.md index eaed4fb6..dc106c97 100644 --- a/docs/variables.md +++ b/docs/variables.md @@ -730,6 +730,12 @@ alternatively, you can mount: /etc/localtime:/etc/localtime:ro ✅ + + CF_API_KEY_FILE + A path to a file inside of container that contains YOUR CurseForge (Eternal) API Key. + + ✅ + CF_PAGE_URL Pass a page URL to the modpack or a specific file diff --git a/scripts/start-deployAutoCF b/scripts/start-deployAutoCF index e4b9870d..16f14943 100644 --- a/scripts/start-deployAutoCF +++ b/scripts/start-deployAutoCF @@ -24,6 +24,11 @@ set -eu resultsFile=/data/.install-curseforge.env +if [[ -n ${CF_API_KEY_FILE} ]]; then + CF_API_KEY="$(cat "${CF_API_KEY_FILE}")" + export CF_API_KEY +fi + isDebugging && set -x ensureRemoveAllModsOff "MODPACK_PLATFORM=AUTO_CURSEFORGE" @@ -61,7 +66,7 @@ if ! mc-image-helper install-curseforge "${args[@]}"; then exit 1 fi -applyResultsFile ${resultsFile} +applyResultsFile "${resultsFile}" resolveFamily exec "${SCRIPTS:-/}start-setupWorld" "$@" diff --git a/scripts/start-setupModpack b/scripts/start-setupModpack index 7109330b..8104b0b5 100755 --- a/scripts/start-setupModpack +++ b/scripts/start-setupModpack @@ -13,6 +13,12 @@ set -e -o pipefail : "${REMOVE_OLD_MODS_INCLUDE:=*.jar,*-version.json}" sum_file=/data/.generic_pack.sum + +if [[ -n ${CF_API_KEY_FILE} ]]; then + CF_API_KEY="$(cat "${CF_API_KEY_FILE}")" + export CF_API_KEY +fi + # shellcheck source=start-utils . "${SCRIPTS:-/}start-utils" isDebugging && set -x @@ -195,7 +201,7 @@ function handleGenericPacks() { # Disable mods for mod in ${GENERIC_PACKS_DISABLE_MODS}; do - log Disabling $mod + log Disabling "$mod" find "${base_dir}" -name "$mod" -exec mv {} {}.disabled -v \; done