feat(server): export ReleaseVersion

releaseVersion is needed in etcd.go to print it out in the -version
flag.
This commit is contained in:
Brandon Philips 2013-10-16 12:38:32 -07:00
parent f998a19c3d
commit 7670c85d70
4 changed files with 5 additions and 4 deletions

View File

@ -2,6 +2,7 @@ package main
import (
"flag"
"fmt"
"io/ioutil"
"os"
"strings"
@ -121,7 +122,7 @@ func main() {
flag.Parse()
if printVersion {
fmt.Println(releaseVersion)
fmt.Println(server.ReleaseVersion)
os.Exit(0)
}

View File

@ -4,5 +4,5 @@ VER=$(git describe --tags HEAD)
cat <<EOF
package server
const releaseVersion = "$VER"
const ReleaseVersion = "$VER"
EOF

View File

@ -195,7 +195,7 @@ func (s *Server) OriginAllowed(origin string) bool {
// Handler to return the current version of etcd.
func (s *Server) GetVersionHandler(w http.ResponseWriter, req *http.Request) error {
w.WriteHeader(http.StatusOK)
fmt.Fprintf(w, "etcd %s", releaseVersion)
fmt.Fprintf(w, "etcd %s", ReleaseVersion)
return nil
}

View File

@ -5,4 +5,4 @@ const Version = "v2"
// TODO: The release version (generated from the git tag) will be the raft
// protocol version for now. When things settle down we will fix it like the
// client API above.
const PeerVersion = releaseVersion
const PeerVersion = ReleaseVersion