Allow for build time version override

This commit is contained in:
xenolf 2016-01-09 02:13:13 +01:00
parent 9c099c8739
commit 532c313855

11
cli.go
View file

@ -4,6 +4,7 @@ import (
"log" "log"
"os" "os"
"path" "path"
"strings"
"github.com/codegangsta/cli" "github.com/codegangsta/cli"
"github.com/xenolf/lego/acme" "github.com/xenolf/lego/acme"
@ -20,11 +21,19 @@ func logger() *log.Logger {
return Logger return Logger
} }
var gittag string
func main() { func main() {
app := cli.NewApp() app := cli.NewApp()
app.Name = "lego" app.Name = "lego"
app.Usage = "Let's encrypt client to go!" app.Usage = "Let's encrypt client to go!"
app.Version = "0.1.0"
version := "0.2.0"
if strings.HasPrefix(gittag, "v") {
version = gittag
}
app.Version = version
acme.UserAgent = "lego/" + app.Version acme.UserAgent = "lego/" + app.Version