feat(auth): authenticate with FORGEJO_TOKEN env var, fall back to keys.json (FJMCP-21) #31
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/FJMCP-21-forgejo-token-env"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Read FORGEJO_TOKEN once in ForgejoServer::from_env_with_policy alongside FORGEJO_HOST. When set and non-empty it builds the authenticated Forgejo client directly via Auth::Token, decoupled from the fj CLI's keys.json, so a deployment (notably the http service mode) can supply a credential without installing or configuring fj. When unset, the server falls back to the existing keys.json lookup so local development keeps working unchanged.
Both api() and api_and_token() honor the token: the latter returns it alongside the client for attachment downloads. Update the module doc comment, the server tool-description string, and the README (Authentication section, configuration table, HTTP transport notes) to document FORGEJO_TOKEN and the env-first-with-fallback precedence. Add a unit test that the token path builds an authenticated client without touching keys.json.
Fixes FJMCP-21
feat(auth): authenticate with FORGEJO_TOKEN env var, fall back to keys.jsonto feat(auth): authenticate with FORGEJO_TOKEN env var, fall back to keys.json (FJMCP-21)