Skip to content

feat: env-var secrets, blackhole client registration, request logging & /ping health#6

Merged
roziscoding merged 13 commits into
mainfrom
feat/config-secret-env
Jun 2, 2026
Merged

feat: env-var secrets, blackhole client registration, request logging & /ping health#6
roziscoding merged 13 commits into
mainfrom
feat/config-secret-env

Conversation

@roziscoding

@roziscoding roziscoding commented Jun 1, 2026

Copy link
Copy Markdown
Owner

Summary

  • Env-var secrets in config — any apiKey (jack, sources, peers, destinations) can now be written as { "env": "VAR" } and is resolved from the environment at load time via a reusable ConfigSecret schema. 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" } for jack.apiKey, falling back to an empty config when it isn't set yet so a fresh install still boots.
  • Auto-register Torrent Blackhole download client in Radarr/Sonarr on startup (when downloads is configured), idempotently updating an existing Jack client instead of duplicating.
  • Always mount /peer and /torznab routes — they now serve empty results when there's no local source / no peers, instead of being conditionally absent.
  • Better registration error logs — surface the *arr 400 response body (the actual validation message) instead of a bare "Bad Request".
  • Default port 3000 → 5225 across env defaults, Dockerfile, compose examples, and docs.
  • Request logging middleware — logs every request (method, path, status, duration) at trace level, on response.
  • Logger reads from validated envsLOG_LEVEL/ENVIRONMENT now come from the zod-validated Envs schema instead of raw process.env, so the logger honors the same defaults (LOG_LEVEL=info) and validation as the rest of the app.
  • /ping health endpoint — unauthenticated GET /ping returning { "status": "OK" } with 200, wired as the container HEALTHCHECK in the Dockerfile.

Tests

  • New config.test.ts covering ConfigSecret and AppConfig env-reference parsing.
  • Integration tests for registerDownloadClient (create + update) and for the routes mounting without peers/sources.
  • e2e tests updated for always-on indexer registration and the new download-client registration.

bun test passes for the backend suites (41 pass / 0 fail).

…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.
@roziscoding roziscoding changed the title feat: env-var secrets, blackhole client auto-registration, default port 5225 feat: env-var secrets, blackhole client registration, request logging & /ping health Jun 1, 2026
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.
@roziscoding roziscoding merged commit ac72a8d into main Jun 2, 2026
5 checks passed
@roziscoding roziscoding deleted the feat/config-secret-env branch June 2, 2026 00:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant