cf: default API cache TTL to 2 days and allow config (#3107)

This commit is contained in:
Geoff Bourne 2024-10-15 07:54:30 -05:00 committed by GitHub
parent 4085d28773
commit fd20fc9654
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 24 additions and 41 deletions

View file

@ -50,7 +50,7 @@ RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
--var version=${MC_SERVER_RUNNER_VERSION} --var app=mc-server-runner --file {{.app}} \
--from ${GITHUB_BASEURL}/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz
ARG MC_HELPER_VERSION=1.40.0
ARG MC_HELPER_VERSION=1.40.1
ARG MC_HELPER_BASE_URL=${GITHUB_BASEURL}/itzg/mc-image-helper/releases/download/${MC_HELPER_VERSION}
# used for cache busting local copy of mc-image-helper
ARG MC_HELPER_REV=1
@ -77,4 +77,4 @@ RUN curl -fsSL -o /image/Log4jPatcher.jar https://github.com/CreeperHost/Log4jPa
RUN dos2unix /start* /auto/*
ENTRYPOINT [ "/start" ]
HEALTHCHECK --start-period=30s --retries=24 --interval=60s CMD mc-health
HEALTHCHECK --start-period=2m --retries=2 --interval=30s CMD mc-health

View file

@ -9,7 +9,7 @@
|
+-- project slug
```
Also, a specific version (or release type) can be declared adding a colon and then the version id, version name, or release type after the project slug. The version ID can be found in the 'Metadata' section. Valid release types are `release`, `beta`, `alpha`.
Also, a specific version (or release type) can be declared adding a colon and then the version id, version number/name, or release type after the project slug. The version ID or number can be found in the 'Metadata' section. Valid release types are `release`, `beta`, `alpha`.
To select a datapack from a Modrinth project, prefix the entry with "datapack:". When running a vanilla server, this is optional since only datapacks will be available for vanilla servers to select.

View file

@ -20,6 +20,7 @@ set -eu
: "${CF_OVERRIDES_EXCLUSIONS:=}" # --overrides-exclusions
: "${CF_DOWNLOADS_REPO=$([ -d /downloads ] && echo '/downloads' || echo '')}"
: "${CF_MODPACK_MANIFEST:=}"
: "${CF_API_CACHE_DEFAULT_TTL:=}" # as ISO-8601 duration, such as P2D or PT12H
resultsFile=/data/.install-curseforge.env
@ -29,49 +30,31 @@ ensureRemoveAllModsOff "MOD_PLATFORM=AUTO_CURSEFORGE"
args=(
--results-file="$resultsFile"
)
if [[ $CF_PAGE_URL ]]; then
args+=(--modpack-page-url="$CF_PAGE_URL")
fi
if [[ $CF_FILE_ID ]]; then
args+=(--file-id="$CF_FILE_ID")
fi
if [[ $CF_SLUG ]]; then
args+=(--slug="$CF_SLUG")
fi
if [[ $CF_MODPACK_MANIFEST ]]; then
args+=(--modpack-manifest="$CF_MODPACK_MANIFEST")
fi
if [[ $CF_FILENAME_MATCHER ]]; then
args+=(--filename-matcher="$CF_FILENAME_MATCHER")
fi
if [[ ${CF_SET_LEVEL_FROM} ]]; then
args+=(--set-level-from="$CF_SET_LEVEL_FROM")
fi
if [[ ${CF_OVERRIDES_EXCLUSIONS} ]]; then
args+=(--overrides-exclusions="$CF_OVERRIDES_EXCLUSIONS")
fi
if [[ ${CF_IGNORE_MISSING_FILES} ]]; then
args+=(--ignore-missing-files="$CF_IGNORE_MISSING_FILES")
fi
args+=(
--force-synchronize="$CF_FORCE_SYNCHRONIZE"
--force-reinstall-modloader="$CF_FORCE_REINSTALL_MODLOADER"
--overrides-skip-existing="$CF_OVERRIDES_SKIP_EXISTING"
)
setArg() {
arg="${1?}"
var="${2?}"
if [[ $CF_EXCLUDE_MODS ]]; then
args+=( --exclude-mods="$CF_EXCLUDE_MODS" )
fi
if [[ $CF_FORCE_INCLUDE_MODS ]]; then
args+=( --force-include-mods="$CF_FORCE_INCLUDE_MODS" )
fi
if [[ $CF_EXCLUDE_INCLUDE_FILE ]]; then
args+=( --exclude-include-file="$CF_EXCLUDE_INCLUDE_FILE" )
fi
if [[ $CF_DOWNLOADS_REPO ]]; then
args+=( --downloads-repo="$CF_DOWNLOADS_REPO" )
fi
if [[ ${!var} ]]; then
args+=("${arg}=${!var}")
fi
}
setArg --modpack-page-url CF_PAGE_URL
setArg --file-id CF_FILE_ID
setArg --slug CF_SLUG
setArg --modpack-manifest CF_MODPACK_MANIFEST
setArg --filename-matcher CF_FILENAME_MATCHER
setArg --set-level-from CF_SET_LEVEL_FROM
setArg --overrides-exclusions CF_OVERRIDES_EXCLUSIONS
setArg --ignore-missing-files CF_IGNORE_MISSING_FILES
setArg --api-cache-default-ttl CF_API_CACHE_DEFAULT_TTL
setArg --exclude-mods CF_EXCLUDE_MODS
setArg --force-include-mods CF_FORCE_INCLUDE_MODS
setArg --exclude-include-file CF_EXCLUDE_INCLUDE_FILE
setArg --downloads-repo CF_DOWNLOADS_REPO
if ! mc-image-helper install-curseforge "${args[@]}"; then
log "ERROR failed to auto-install CurseForge modpack"