Support default hosts.toml configuration
Add support for an optional `default` registry hosts config, should no other hosts config match. Signed-off-by: Jess <jess@ros.io>
This commit is contained in:
parent
c21d1baa88
commit
f0bf9e7f8b
@ -24,16 +24,18 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
)
|
)
|
||||||
|
|
||||||
func hostPaths(root, host string) []string {
|
func hostPaths(root, host string) (hosts []string) {
|
||||||
ch := hostDirectory(host)
|
ch := hostDirectory(host)
|
||||||
if ch == host {
|
if ch != host {
|
||||||
return []string{filepath.Join(root, host)}
|
hosts = append(hosts, filepath.Join(root, ch))
|
||||||
}
|
}
|
||||||
|
|
||||||
return []string{
|
hosts = append(hosts,
|
||||||
filepath.Join(root, ch),
|
|
||||||
filepath.Join(root, host),
|
filepath.Join(root, host),
|
||||||
}
|
filepath.Join(root, "_default"),
|
||||||
|
)
|
||||||
|
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func rootSystemPool() (*x509.CertPool, error) {
|
func rootSystemPool() (*x509.CertPool, error) {
|
||||||
|
@ -22,16 +22,18 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
func hostPaths(root, host string) []string {
|
func hostPaths(root, host string) (hosts []string) {
|
||||||
ch := hostDirectory(host)
|
ch := hostDirectory(host)
|
||||||
if ch == host {
|
if ch != host {
|
||||||
return []string{filepath.Join(root, host)}
|
hosts = append(hosts, filepath.Join(root, strings.Replace(ch, ":", "", -1)))
|
||||||
}
|
}
|
||||||
|
|
||||||
return []string{
|
hosts = append(hosts,
|
||||||
filepath.Join(root, strings.Replace(ch, ":", "", -1)),
|
|
||||||
filepath.Join(root, strings.Replace(host, ":", "", -1)),
|
filepath.Join(root, strings.Replace(host, ":", "", -1)),
|
||||||
}
|
filepath.Join(root, "_default"),
|
||||||
|
)
|
||||||
|
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func rootSystemPool() (*x509.CertPool, error) {
|
func rootSystemPool() (*x509.CertPool, error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user