feat: env-var secrets, blackhole client registration, request logging & /ping health#6
Merged
Merged
Conversation
…rt 5225
Config secrets can now be supplied as `{ "env": "VAR" }` references in addition
to plain strings, resolved at load time via a reusable `ConfigSecret` schema.
The default config written on first boot uses the env form for `jack.apiKey`
and falls back to an empty config when the referenced vars aren't set yet.
Also auto-register a Torrent Blackhole download client in Radarr/Sonarr on
startup (when `downloads` is configured), always mount the /peer and /torznab
routes (serving empty results without sources/peers), surface *arr 400 bodies
on registration failures, and change the default port from 3000 to 5225.
Add a Hono middleware that logs every request's method and path on entry and the method, path, status, and duration on completion, all at trace level.
Read LOG_LEVEL and ENVIRONMENT from the validated Envs schema instead of raw process.env, so the logger respects the same defaults (LOG_LEVEL=info) and validation as the rest of the app.
Add an unauthenticated GET /ping that returns { status: "OK" } with 200, and
wire it as the container HEALTHCHECK in the Dockerfile.
Compute the PR head commit's short SHA and surface it in the sticky image comment, so it's clear which commit the current pr-<number> tag was built from.
The Torrent Blackhole client is registered with literal watch/completed paths that *arr resolves in its own filesystem, so the same folder must be mounted into Radarr and Sonarr at the same paths jack uses, or grabs fail.
Document the common startup/registration failures and their fixes: blackhole download-client path mismatches, empty-indexer rejection when no peers are configured, connector connection-refused on boot ordering, and using trace logs / the *arr response body to diagnose.
Make the intent explicit: we want *arr to run its validation test on save and reject bad registrations, so a failure surfaces (and is logged) instead of silently registering a broken indexer or download client.
Without peers there's nothing to search and nothing to grab, and *arr rejects an indexer whose test query returns no results — so skip indexer and download client registration entirely (with an info log) when no peers are configured. Run the container as the image's non-root `bun` user (uid/gid 1000) to match the PUID/PGID the *arr / linuxserver.io images default to, so files jack writes to the blackhole completed folder are owned by the user that imports them. Pre-chown /config so first-boot config writes work on a fresh volume. Update the e2e suite accordingly: Jack Alpha (no peers) now asserts it does NOT register, and the blackhole volumes are made world-writable so the uid-1000 containers can read/write them regardless of the host runner's uid.
v4 runs on Node 20, which GitHub is deprecating on the Actions runners. v5 runs on Node 24.
Several actions still ran on the deprecated Node 20 runtime. Bump the ones with a stable Node 24 major release, after confirming the inputs/outputs we use are unchanged: - cycjimmy/semantic-release-action v4 -> v5 - docker/setup-buildx-action v3 -> v4 - docker/login-action v3 -> v4 - docker/metadata-action v5 -> v6 - docker/build-push-action v6 -> v7 - marocchino/sticky-pull-request-comment v2 -> v3 jdx/mise-action is left at v2: it has no Node 24 release yet (v3 and the latest tag are still Node 20), so bumping wouldn't help. Revisit once it ships one.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
apiKey(jack,sources,peers,destinations) can now be written as{ "env": "VAR" }and is resolved from the environment at load time via a reusableConfigSecretschema. Plain strings keep working unchanged. Missing/empty referenced vars fail loudly with the var name. The default config written on first boot uses{ "env": "JACK_API_KEY" }forjack.apiKey, falling back to an empty config when it isn't set yet so a fresh install still boots.downloadsis configured), idempotently updating an existing Jack client instead of duplicating./peerand/torznabroutes — they now serve empty results when there's no local source / no peers, instead of being conditionally absent.400response body (the actual validation message) instead of a bare "Bad Request".tracelevel, on response.LOG_LEVEL/ENVIRONMENTnow come from the zod-validatedEnvsschema instead of rawprocess.env, so the logger honors the same defaults (LOG_LEVEL=info) and validation as the rest of the app./pinghealth endpoint — unauthenticatedGET /pingreturning{ "status": "OK" }with 200, wired as the containerHEALTHCHECKin the Dockerfile.Tests
config.test.tscoveringConfigSecretandAppConfigenv-reference parsing.registerDownloadClient(create + update) and for the routes mounting without peers/sources.bun testpasses for the backend suites (41 pass / 0 fail).