diff --git a/scripts/patch-listening-endpoint-runtime-guards.mjs b/scripts/patch-listening-endpoint-runtime-guards.mjs index 8d3e9c4c..472b1f58 100644 --- a/scripts/patch-listening-endpoint-runtime-guards.mjs +++ b/scripts/patch-listening-endpoint-runtime-guards.mjs @@ -80,6 +80,33 @@ const patchSpecs = [ throw err; } + // Update stats cache after sync`, + candidates: [ + "node_modules/@rmdes/indiekit-endpoint-funkwhale/lib/sync.js", + "node_modules/@indiekit/indiekit/node_modules/@rmdes/indiekit-endpoint-funkwhale/lib/sync.js", + ], + }, + { + name: "funkwhale-sync-network-error-guard", + marker: "Cannot reach Funkwhale instance; skipping sync", + oldSnippet: ` throw err; + } + + // Update stats cache after sync`, + newSnippet: ` const causeCode = String(err?.cause?.code || ""); + if ( + /fetch failed/i.test(message) || + /ECONNREFUSED|ENOTFOUND|ETIMEDOUT/.test(causeCode) + ) { + // Cannot reach Funkwhale instance; skipping sync + console.warn( + "[Funkwhale] Cannot reach Funkwhale instance; skipping sync. Check FUNKWHALE_INSTANCE is reachable." + ); + return { synced: 0, error: "Network error" }; + } + throw err; + } + // Update stats cache after sync`, candidates: [ "node_modules/@rmdes/indiekit-endpoint-funkwhale/lib/sync.js", diff --git a/start.example.sh b/start.example.sh index e8aa0b8f..6a6cffe4 100644 --- a/start.example.sh +++ b/start.example.sh @@ -30,11 +30,6 @@ if [ -z "${MONGO_URL:-}" ]; then export MONGO_AUTH_SOURCE="${MONGO_AUTH_SOURCE:-admin}" fi -if [ -z "${GH_CONTENT_TOKEN:-}" ] && [ -z "${GITHUB_TOKEN:-}" ]; then - echo "GH_CONTENT_TOKEN or GITHUB_TOKEN is required" >&2 - exit 1 -fi - # Force production runtime and keep debug logging disabled. export NODE_ENV="production" export INDIEKIT_DEBUG="0"