Skip to content

Commit

Permalink
Move api version string to repo config
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: rht <rhtbot@gmail.com>
  • Loading branch information
rht authored and whyrusleeping committed Dec 28, 2015
1 parent 0123971 commit aabf807
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 1 addition & 2 deletions commands/http/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion commands/http/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
2 changes: 2 additions & 0 deletions repo/config/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit aabf807

Please sign in to comment.