mirror of
https://github.com/patriceckhart/zot.git
synced 2026-06-26 21:36:31 +02:00
Scan all known providers in credential fallback (adopts #16)
This commit is contained in:
parent
323df7f6d3
commit
eef2714dea
1 changed files with 9 additions and 6 deletions
|
|
@ -317,12 +317,15 @@ func Resolve(args Args, requireCred bool) (Resolved, error) {
|
|||
// never shows a "not logged in" banner.
|
||||
userPickedProvider := args.Provider != ""
|
||||
if credErr != nil && !userPickedProvider && provName != "ollama" {
|
||||
// amazon-bedrock is included so an env-only bedrock setup
|
||||
// (AWS_BEARER_TOKEN_BEDROCK / AWS_PROFILE / IAM keys) is still
|
||||
// discovered when no config.json pins the provider, e.g. after
|
||||
// pointing ZOT_HOME at a fresh home dir.
|
||||
for _, other := range []string{"anthropic", "openai", "openai-codex", "kimi", "deepseek", "google", "amazon-bedrock"} {
|
||||
if other == provName {
|
||||
// Scan every known provider (not a hardcoded subset) so any
|
||||
// env-based credential is discovered, e.g. an env-only
|
||||
// amazon-bedrock setup (AWS_BEARER_TOKEN_BEDROCK / AWS_PROFILE /
|
||||
// IAM keys) when no config.json pins the provider, such as after
|
||||
// pointing ZOT_HOME at a fresh home dir. Iteration order of
|
||||
// knownProviders defines fallback priority. ollama is skipped:
|
||||
// it has no credential and would always "match".
|
||||
for _, other := range knownProviders {
|
||||
if other == provName || other == "ollama" {
|
||||
continue
|
||||
}
|
||||
if c, m, a, err := ResolveCredentialFull(other, args.APIKey); err == nil {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue