Skip to content

fetch.Resolver: accept per-ecosystem base URLs #80

Description

@andrew

The fetch.Resolver fallback path (resolveWithoutRegistry in fetch/resolver.go) builds download URLs from hardcoded public hosts (registry.npmjs.org, static.crates.io, rubygems.org, proxy.golang.org, repo.hex.pm, pub.dev, repo1.maven.org, api.nuget.org). NewResolver() has no way to override them, and callers that never RegisterRegistry always hit the fallback.

git-pkgs/proxy now lets every built-in upstream be configured (git-pkgs/proxy#255) so one proxy can chain to another or to a private mirror. The HTTP-serving path builds URLs itself and honours the config, but the mirror subcommand goes through fetch.Resolver and still fetches from the public registries regardless of what the operator set.

Proposed change: let NewResolver (or a new constructor / functional option) take a map[string]string of ecosystem → base URL and use it in place of the literals in resolveWithoutRegistry, falling back to the current defaults when a key is absent. registries.New(ecosystem, baseURL, client) already accepts a base URL, so an alternative is to have the resolver construct a Registry per ecosystem from that map instead of keeping the switch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions