Added version checker on startup
This commit is contained in:
parent
0bbf343348
commit
2048e9e136
5 changed files with 32 additions and 6 deletions
|
@ -1,6 +1,7 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
|
@ -9,6 +10,7 @@ import (
|
|||
"github.com/rs/zerolog"
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/spf13/viper"
|
||||
"github.com/tcnksm/go-latest"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
@ -38,6 +40,19 @@ func main() {
|
|||
NoColor: !colors,
|
||||
})
|
||||
|
||||
githubTag := &latest.GithubTag{
|
||||
Owner: "juanfont",
|
||||
Repository: "headscale",
|
||||
}
|
||||
|
||||
if cli.Version != "dev" {
|
||||
res, _ := latest.Check(githubTag, cli.Version)
|
||||
if res.Outdated {
|
||||
fmt.Printf("An updated version of Headscale has been found (%s vs. your current %s). Check it out https://github.com/juanfont/headscale/releases\n",
|
||||
res.Current, cli.Version)
|
||||
}
|
||||
}
|
||||
|
||||
err := cli.LoadConfig("")
|
||||
if err != nil {
|
||||
log.Fatal().Err(err)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue