mirror of https://git.sr.ht/~ashkeel/strimertul
Add version to executable
This commit is contained in:
parent
65d6be5ec3
commit
84bef02a42
|
@ -0,0 +1,2 @@
|
||||||
|
$APPVERSION=git describe --tags --always
|
||||||
|
go build -ldflags "-X main.appVersion=$APPVERSION"
|
7
main.go
7
main.go
|
@ -34,6 +34,8 @@ const AppHeader = `
|
||||||
(_-< _| '_| | ' \/ -_) '_| _| || | |
|
(_-< _| '_| | ' \/ -_) '_| _| || | |
|
||||||
/__/\__|_| |_|_|_|_\___|_| \__|\_,_|_| `
|
/__/\__|_| |_|_|_|_\___|_| \__|\_,_|_| `
|
||||||
|
|
||||||
|
var appVersion = "v0.0.0-UNKNOWN"
|
||||||
|
|
||||||
const DefaultBind = "localhost:4337"
|
const DefaultBind = "localhost:4337"
|
||||||
|
|
||||||
//go:embed frontend/dist/*
|
//go:embed frontend/dist/*
|
||||||
|
@ -78,6 +80,8 @@ func main() {
|
||||||
if !*noheader {
|
if !*noheader {
|
||||||
// Print the app header :D
|
// Print the app header :D
|
||||||
fmt.Println(AppHeader)
|
fmt.Println(AppHeader)
|
||||||
|
// Print version info
|
||||||
|
fmt.Printf("\n %s - %s/%s (%s)\n\n", appVersion, runtime.GOOS, runtime.GOARCH, runtime.Version())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create module manager
|
// Create module manager
|
||||||
|
@ -88,6 +92,9 @@ func main() {
|
||||||
failOnError(err, "Could not open DB")
|
failOnError(err, "Could not open DB")
|
||||||
defer db.Close()
|
defer db.Close()
|
||||||
|
|
||||||
|
// Set meta keys
|
||||||
|
_ = db.PutKey("stul-meta/version", []byte(appVersion))
|
||||||
|
|
||||||
// Check if onboarding was completed
|
// Check if onboarding was completed
|
||||||
var moduleConfig modules.ModuleConfig
|
var moduleConfig modules.ModuleConfig
|
||||||
err = db.GetJSON(modules.ModuleConfigKey, &moduleConfig)
|
err = db.GetJSON(modules.ModuleConfigKey, &moduleConfig)
|
||||||
|
|
Loading…
Reference in New Issue