mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Add arch/os info to user agent (Registry)
This commit is contained in:
parent
efde305c05
commit
e4561438f1
3 changed files with 13 additions and 9 deletions
|
@ -2018,6 +2018,8 @@ func (srv *Server) HTTPRequestFactory(metaHeaders map[string][]string) *utils.HT
|
||||||
httpVersion = append(httpVersion, &simpleVersionInfo{"go", v.Get("GoVersion")})
|
httpVersion = append(httpVersion, &simpleVersionInfo{"go", v.Get("GoVersion")})
|
||||||
httpVersion = append(httpVersion, &simpleVersionInfo{"git-commit", v.Get("GitCommit")})
|
httpVersion = append(httpVersion, &simpleVersionInfo{"git-commit", v.Get("GitCommit")})
|
||||||
httpVersion = append(httpVersion, &simpleVersionInfo{"kernel", v.Get("KernelVersion")})
|
httpVersion = append(httpVersion, &simpleVersionInfo{"kernel", v.Get("KernelVersion")})
|
||||||
|
httpVersion = append(httpVersion, &simpleVersionInfo{"os", v.Get("Os")})
|
||||||
|
httpVersion = append(httpVersion, &simpleVersionInfo{"arch", v.Get("Arch")})
|
||||||
ud := utils.NewHTTPUserAgentDecorator(httpVersion...)
|
ud := utils.NewHTTPUserAgentDecorator(httpVersion...)
|
||||||
md := &utils.HTTPMetaHeadersDecorator{
|
md := &utils.HTTPMetaHeadersDecorator{
|
||||||
Headers: metaHeaders,
|
Headers: metaHeaders,
|
||||||
|
|
|
@ -76,9 +76,9 @@ type HTTPUserAgentDecorator struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewHTTPUserAgentDecorator(versions ...VersionInfo) HTTPRequestDecorator {
|
func NewHTTPUserAgentDecorator(versions ...VersionInfo) HTTPRequestDecorator {
|
||||||
ret := new(HTTPUserAgentDecorator)
|
return &HTTPUserAgentDecorator{
|
||||||
ret.versions = versions
|
versions: versions,
|
||||||
return ret
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *HTTPUserAgentDecorator) ChangeRequest(req *http.Request) (newReq *http.Request, err error) {
|
func (h *HTTPUserAgentDecorator) ChangeRequest(req *http.Request) (newReq *http.Request, err error) {
|
||||||
|
@ -113,10 +113,10 @@ type HTTPAuthDecorator struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewHTTPAuthDecorator(login, password string) HTTPRequestDecorator {
|
func NewHTTPAuthDecorator(login, password string) HTTPRequestDecorator {
|
||||||
ret := new(HTTPAuthDecorator)
|
return &HTTPAuthDecorator{
|
||||||
ret.login = login
|
login: login,
|
||||||
ret.password = password
|
password: password,
|
||||||
return ret
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *HTTPAuthDecorator) ChangeRequest(req *http.Request) (*http.Request, error) {
|
func (self *HTTPAuthDecorator) ChangeRequest(req *http.Request) (*http.Request, error) {
|
||||||
|
|
|
@ -25,6 +25,8 @@ func dockerVersion() *engine.Env {
|
||||||
v.Set("Version", VERSION)
|
v.Set("Version", VERSION)
|
||||||
v.Set("GitCommit", GITCOMMIT)
|
v.Set("GitCommit", GITCOMMIT)
|
||||||
v.Set("GoVersion", runtime.Version())
|
v.Set("GoVersion", runtime.Version())
|
||||||
|
v.Set("Os", runtime.GOOS)
|
||||||
|
v.Set("Arch", runtime.GOARCH)
|
||||||
// FIXME:utils.GetKernelVersion should only be needed here
|
// FIXME:utils.GetKernelVersion should only be needed here
|
||||||
if kernelVersion, err := utils.GetKernelVersion(); err == nil {
|
if kernelVersion, err := utils.GetKernelVersion(); err == nil {
|
||||||
v.Set("KernelVersion", kernelVersion.String())
|
v.Set("KernelVersion", kernelVersion.String())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue