Move api version string to repo config

License: MIT
Signed-off-by: rht <rhtbot@gmail.com>
This commit is contained in:
rht 2015-12-16 10:50:37 +07:00 committed by Jeromy
parent 0123971118
commit aabf80723d
3 changed files with 4 additions and 3 deletions

View File

@ -100,8 +100,7 @@ func (c *client) Send(req cmds.Request) (cmds.Response, error) {
} else {
httpReq.Header.Set(contentTypeHeader, applicationOctetStream)
}
version := config.CurrentVersionNumber
httpReq.Header.Set(uaHeader, fmt.Sprintf("/go-ipfs/%s/", version))
httpReq.Header.Set(uaHeader, config.ApiVersion)
ec := make(chan error, 1)
rc := make(chan cmds.Response, 1)

View File

@ -439,7 +439,7 @@ func apiVersionMatches(r *http.Request) error {
return nil
}
daemonVersion := fmt.Sprintf("/go-ipfs/%s/", config.CurrentVersionNumber)
daemonVersion := config.ApiVersion
if daemonVersion != clientVersion {
return fmt.Errorf("%s (%s != %s)", errApiVersionMismatch, daemonVersion, clientVersion)
}

View File

@ -10,6 +10,8 @@ import (
// CurrentVersionNumber is the current application's version literal
const CurrentVersionNumber = "0.3.11-dev"
const ApiVersion = "/go-ipfs/" + CurrentVersionNumber + "/"
// CurrentCommit is the current git commit, this is set as a ldflag in the Makefile
var CurrentCommit string