Skip to content

Commit

Permalink
Add new version checker
Browse files Browse the repository at this point in the history
Checks for new versions with the "usage" service and automatically displays a
standard version message when the "--version" flag is passed.
  • Loading branch information
mgood committed Aug 18, 2015
1 parent 28e7d0c commit 18dcd45
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions registrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,19 @@ package main
import (
"errors"
"flag"
"fmt"
"log"
"os"
"time"

dockerapi "github.com/fsouza/go-dockerclient"
"github.com/gliderlabs/pkg/usage"
"github.com/gliderlabs/registrator/bridge"
)

var Version string

var versionChecker = usage.NewChecker("registrator", Version)

var hostIp = flag.String("ip", "", "IP for ports mapped to the host")
var internal = flag.Bool("internal", false, "Use internal ports instead of published ones")
var refreshInterval = flag.Int("ttl-refresh", 0, "Frequency with which service TTLs are refreshed")
Expand All @@ -37,7 +39,7 @@ func assert(err error) {

func main() {
if len(os.Args) == 2 && os.Args[1] == "--version" {
fmt.Println(Version)
versionChecker.PrintVersion()
os.Exit(0)
}
log.Printf("Starting registrator %s ...", Version)
Expand Down

0 comments on commit 18dcd45

Please sign in to comment.