mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-06 01:07:41 +08:00
use main.version rather than subpackage variables
This commit is contained in:
3
main.go
3
main.go
@@ -26,8 +26,11 @@ import (
|
|||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var version = "dev"
|
||||||
|
|
||||||
// Start DB Connection and start API Request Handler
|
// Start DB Connection and start API Request Handler
|
||||||
func main() {
|
func main() {
|
||||||
|
servercfg.SetVersion(version)
|
||||||
fmt.Println(models.RetrieveLogo()) // print the logo
|
fmt.Println(models.RetrieveLogo()) // print the logo
|
||||||
initialize() // initial db and grpc server
|
initialize() // initial db and grpc server
|
||||||
setGarbageCollection()
|
setGarbageCollection()
|
||||||
|
@@ -13,11 +13,14 @@ import (
|
|||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var version = "dev"
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
app := cli.NewApp()
|
app := cli.NewApp()
|
||||||
app.Name = "Netclient CLI"
|
app.Name = "Netclient CLI"
|
||||||
app.Usage = "Netmaker's netclient agent and CLI. Used to perform interactions with Netmaker server and set local WireGuard config."
|
app.Usage = "Netmaker's netclient agent and CLI. Used to perform interactions with Netmaker server and set local WireGuard config."
|
||||||
app.Version = ncutils.Version
|
app.Version = version
|
||||||
|
ncutils.SetVersion(version)
|
||||||
|
|
||||||
cliFlags := cli_options.GetFlags(ncutils.GetHostname())
|
cliFlags := cli_options.GetFlags(ncutils.GetHostname())
|
||||||
app.Commands = cli_options.GetCommands(cliFlags[:])
|
app.Commands = cli_options.GetCommands(cliFlags[:])
|
||||||
|
@@ -73,6 +73,11 @@ const (
|
|||||||
letterIdxMax = 63 / letterIdxBits // # of letter indices fitting in 63 bits
|
letterIdxMax = 63 / letterIdxBits // # of letter indices fitting in 63 bits
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// SetVersion -- set netclient version for use by other packages
|
||||||
|
func SetVersion(ver string) {
|
||||||
|
Version = ver
|
||||||
|
}
|
||||||
|
|
||||||
// Log - logs a message
|
// Log - logs a message
|
||||||
func Log(message string) {
|
func Log(message string) {
|
||||||
log.SetFlags(log.Flags() &^ (log.Llongfile | log.Lshortfile))
|
log.SetFlags(log.Flags() &^ (log.Llongfile | log.Lshortfile))
|
||||||
|
@@ -1,20 +1,20 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#server build
|
#server build
|
||||||
env CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -ldflags="-X 'github.com/gravitl/netmaker/servercfg/serverconf.Version=$VERSION'" -o netclient/build/netmaker main.go
|
env CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -ldflags="-X 'main.version=$VERSION'" -o netclient/build/netmaker main.go
|
||||||
|
|
||||||
cd netclient
|
cd netclient
|
||||||
|
|
||||||
#client build
|
#client build
|
||||||
env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-X 'github.com/gravitl/netmaker/netclient/ncutils/netclientutils.Version=$VERSION'" -o build/netclient main.go
|
env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-X 'main.version=$VERSION'" -o build/netclient main.go
|
||||||
env CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=5 go build -ldflags="-X 'github.com/gravitl/netmaker/netclient/ncutils/netclientutils.Version=$VERSION'" -o build/netclient-arm5 main.go
|
env CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=5 go build -ldflags="-X 'main.version=$VERSION'" -o build/netclient-arm5 main.go
|
||||||
env CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -ldflags="-X 'github.com/gravitl/netmaker/netclient/ncutils/netclientutils.Version=$VERSION'" -o build/netclient-arm6 main.go
|
env CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -ldflags="-X 'main.version=$VERSION'" -o build/netclient-arm6 main.go
|
||||||
env CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 go build -ldflags="-X 'github.com/gravitl/netmaker/netclient/ncutils/netclientutils.Version=$VERSION'" -o build/netclient-arm7 main.go
|
env CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 go build -ldflags="-X 'main.version=$VERSION'" -o build/netclient-arm7 main.go
|
||||||
env CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="-X 'github.com/gravitl/netmaker/netclient/ncutils/netclientutils.Version=$VERSION'" -o build/netclient-arm64 main.go
|
env CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="-X 'main.version=$VERSION'" -o build/netclient-arm64 main.go
|
||||||
env CGO_ENABLED=0 GOOS=linux GOARCH=mipsle go build -ldflags "-s -w -X 'github.com/gravitl/netmaker/netclient/ncutils/netclientutils.Version=$VERSION'" -o build/netclient-mipsle main.go && upx build/netclient-mipsle
|
env CGO_ENABLED=0 GOOS=linux GOARCH=mipsle go build -ldflags "-s -w -X 'main.version=$VERSION'" -o build/netclient-mipsle main.go && upx build/netclient-mipsle
|
||||||
env CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 go build -ldflags="-X 'github.com/gravitl/netmaker/netclient/ncutils/netclientutils.Version=$VERSION'" -o build/netclient-freebsd main.go
|
env CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 go build -ldflags="-X 'main.version=$VERSION'" -o build/netclient-freebsd main.go
|
||||||
env CGO_ENABLED=0 GOOS=freebsd GOARCH=arm GOARM=5 go build -ldflags="-X 'github.com/gravitl/netmaker/netclient/ncutils/netclientutils.Version=$VERSION'" -o build/netclient-freebsd-arm5 main.go
|
env CGO_ENABLED=0 GOOS=freebsd GOARCH=arm GOARM=5 go build -ldflags="-X 'main.version=$VERSION'" -o build/netclient-freebsd-arm5 main.go
|
||||||
env CGO_ENABLED=0 GOOS=freebsd GOARCH=arm GOARM=6 go build -ldflags="-X 'github.com/gravitl/netmaker/netclient/ncutils/netclientutils.Version=$VERSION'" -o build/netclient-freebsd-arm6 main.go
|
env CGO_ENABLED=0 GOOS=freebsd GOARCH=arm GOARM=6 go build -ldflags="-X 'main.version=$VERSION'" -o build/netclient-freebsd-arm6 main.go
|
||||||
env CGO_ENABLED=0 GOOS=freebsd GOARCH=arm GOARM=7 go build -ldflags="-X 'github.com/gravitl/netmaker/netclient/ncutils/netclientutils.Version=$VERSION'" -o build/netclient-freebsd-arm7 main.go
|
env CGO_ENABLED=0 GOOS=freebsd GOARCH=arm GOARM=7 go build -ldflags="-X 'main.version=$VERSION'" -o build/netclient-freebsd-arm7 main.go
|
||||||
env CGO_ENABLED=0 GOOS=freebsd GOARCH=arm64 go build -ldflags="-X 'github.com/gravitl/netmaker/netclient/ncutils/netclientutils.Version=$VERSION'" -o build/netclient-freebsd-arm64 main.go
|
env CGO_ENABLED=0 GOOS=freebsd GOARCH=arm64 go build -ldflags="-X 'main.version=$VERSION'" -o build/netclient-freebsd-arm64 main.go
|
||||||
env CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags="-X 'github.com/gravitl/netmaker/netclient/ncutils/netclientutils.Version=$VERSION'" -o build/netclient-darwin main.go
|
env CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags="-X 'main.version=$VERSION'" -o build/netclient-darwin main.go
|
||||||
|
@@ -118,6 +118,11 @@ func GetAPIConnString() string {
|
|||||||
return conn
|
return conn
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetVersion - set version of netmaker
|
||||||
|
func SetVersion(v string) {
|
||||||
|
Version = v
|
||||||
|
}
|
||||||
|
|
||||||
// GetVersion - version of netmaker
|
// GetVersion - version of netmaker
|
||||||
func GetVersion() string {
|
func GetVersion() string {
|
||||||
return Version
|
return Version
|
||||||
|
Reference in New Issue
Block a user