feat: let the server supply OCR provider tokens with RM_CLAUDE_CODE_OAUTH_TOKEN and RM_ANTHROPIC_API_KEY #19
Loading…
Reference in a new issue
No description provided.
Delete branch "env-ocr-credentials"
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?
Lets the server supply the token for every user's OCR provider (and so chat and suggestions, which reuse it) from the environment, instead of each user saving one in Settings.
RM_CLAUDE_CODE_OAUTH_TOKEN(Claude Code) andRM_ANTHROPIC_API_KEY(Claude API), read inconfig/runtime.exs. They're prefixed so a plainCLAUDE_CODE_OAUTH_TOKEN/ANTHROPIC_API_KEYdoesn't end up in the server's environment forclaudeand other tools to pick up.RM_…" instead of the token field. Model, active provider and auto-transcribe stay per user.OCR.get_provider/2,active_provider/1,save_provider/3andactivate_provider/2fill it in on the loaded config only, and the changeset doesn't cast a credential while it's set.ocr_providers.credentialbecomes nullable, for providers set up with a server token. If the variable is later removed, that provider isn't ready (active_provider/1and the newget_ready_provider/2return nil, so jobs and chat treat it as not set up) until a token is saved in Settings.runtime.exsnote that the token applies to all users, so asetup-tokenshould only be used on an instance that's just yours.Tests: server credential cases in
ocr_test.exsand the settings LiveView (including that theclaudeCLI gets the server's token). Full suite 657 passed;--warnings-as-errors(test and prod) andformat --check-formattedare clean.