Repository navigation
refactor(config): move the provider key store to ~/.infer/auth.yaml - #284
Merged
Merged
Conversation
inference-gateway/cli#1239 renamed the userspace provider-key file to auth.yaml and removed the auth.json read path, so keys saved from Settings -> API Keys landed in a file nothing reads. Desktop-spawned runs kept working only because auth_env() injects the pairs as environment variables, which outrank the auth file - running `infer` from a terminal got no keys. Straight rename matching the CLI, no fallback read. serde_norway already backs the config.yaml reader, so this is a serializer swap, not a new dep. The in-memory type becomes BTreeMap<String, String> - what the file and the frontend Record<string, string> both already are, with deterministic key order on write. auth_path/read_auth/write_auth gain a home-rooted seam so the tests run against a temp dir, mirroring read_config_in. Resolves #282
Contributor
|
🎉 This PR is included in version 0.43.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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
Resolves #282.
inference-gateway/cli#1239 renamed the userspace provider-key file to
~/.infer/auth.yamland removed theauth.jsonread path.backend/src/config.rsstill read and wroteauth.json, so keys entered in Settings -> API Keys landed in a file nothing reads.The breakage was invisible from inside the app:
auth_env()injects the same pairs as environment variables into desktop-spawnedinferprocesses, and the system environment outranks the auth file. It only showed up when runninginferfrom a terminal, where the user got no keys at all.Straight rename matching the CLI - read and write
auth.yamlonly, no fallback branch. Users still holding anauth.jsonre-enter their keys once.serde_norwayalready backs theconfig.yamlreader, so this is a serializer swap rather than a new dependency.Verified against the CLI's current
config/auth.go:AuthFileName = "auth.yaml", parsed as a flatmap[string]string, no JSON fallback, and a warning when the mode is broader than0600.Changes
auth_path()returns~/.infer/auth.yaml;read_auth()/set_auth()go throughserde_norway, keeping the0600chmod on writeserde_json::Map<String, serde_json::Value>toBTreeMap<String, String>- what the file and the frontend'sRecord<string, string>both already are, with deterministic key order on write.get_auth's return type follows;frontend/lib/tauri.tsalready typed it that way, so the TS side is unchangedauth_path/read_auth/ the newwrite_auth_ingain ahome-rooted seam so tests run against a temp dir, mirroring the existingread_config/read_config_inpair in the same file. They also droppub(crate)- onlyauth_env,get_authandset_authare used outside this blockOpenOptions::mode()only applies on create)auth.jsonbeing ignored, and the0600mode - including re-tightening a file left at0644auth.jsonreferences updated: the Settings -> API Keys helper text, thescrub_credentialsdoc comment inexport.rs, and the Export/Import paragraph in the READMEVerification
bun run build,cargo fmt --check,cargo clippy --all-targets -- -D warnings,cargo test(159 passed). No e2e run: the DOM contract is untouched - the only frontend edit is body copy, not a button name or element id.Also checked live against a real
~/.infer/auth.yaml:read_auth()returns all four provider keys andauth_env()passes them through, where the oldauth.jsonpath returned none.Cross-repo
inference-gateway/docsstill saysauth.jsonindesktop.md,cli.mdandconfiguration.md. No new docs ticket - [DOCS] Document the new ~/.infer layout - tmp media dirs and auth.yaml docs#689 already has "any docs pages outside the cli repo that quoteauth.jsonare updated to theauth.yamlrename" in its acceptance criteria.projects.jsonanddesktop.json, separate PR.