add the git sha to the server.

pull/17/head
John Shahid 2013-10-26 12:24:59 -04:00
parent ff62ab4423
commit 07b7fab981
2 changed files with 4 additions and 2 deletions

View File

@ -69,7 +69,8 @@ function build_packages {
function setup_version {
echo "Changing version from dev to $influxdb_version"
sed -i.bak "s/var version = \"dev\"/var version = \"$influxdb_version\"/" src/server/server.go
sha1=`git rev-list --max-count=1 HEAD`
sed -i.bak -e "s/var version = \"dev\"/var version = \"$influxdb_version\"/" -e "s/var gitSha = \"\"/var gitSha = \"$sha1\"/" src/server/server.go
}
function revert_version {

View File

@ -18,13 +18,14 @@ var fileName = flag.String("config", "config.json.sample", "Config file")
var wantsVersion = flag.Bool("version", false, "Get version number")
var version = "dev"
var gitSha = ""
func main() {
runtime.GOMAXPROCS(runtime.NumCPU())
flag.Parse()
if wantsVersion != nil && *wantsVersion {
fmt.Printf("InfluxDB v%s\n", version)
fmt.Printf("InfluxDB v%s (git: %s)\n", version, gitSha)
return
}
config := configuration.LoadConfiguration(*fileName)