37 lines
610 B
Go
37 lines
610 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"github.com/rs/zerolog/log"
|
||
|
)
|
||
|
|
||
|
var Version string
|
||
|
var Buildtime string
|
||
|
var Builduser string
|
||
|
var Buildarch string
|
||
|
|
||
|
type AppIdentity struct {
|
||
|
Version string
|
||
|
Buildtime string
|
||
|
Builduser string
|
||
|
Buildarch string
|
||
|
}
|
||
|
|
||
|
func GetAppIdentity() *AppIdentity {
|
||
|
i := new(AppIdentity)
|
||
|
i.Version = Version
|
||
|
i.Buildtime = Buildtime
|
||
|
i.Builduser = Builduser
|
||
|
i.Buildarch = Buildarch
|
||
|
return i
|
||
|
}
|
||
|
|
||
|
func identify() {
|
||
|
i := GetAppIdentity()
|
||
|
log.Info().
|
||
|
Str("version", i.Version).
|
||
|
Str("buildarch", i.Buildarch).
|
||
|
Str("buildtime", i.Buildtime).
|
||
|
Str("builduser", i.Builduser).
|
||
|
Msg("starting")
|
||
|
}
|