2019-06-17 21:18:47 +00:00
|
|
|
package buildinfo
|
|
|
|
|
|
|
|
import (
|
2020-11-25 06:55:13 +00:00
|
|
|
"github.com/rs/zerolog"
|
2019-06-17 21:18:47 +00:00
|
|
|
"runtime"
|
|
|
|
)
|
|
|
|
|
|
|
|
type BuildInfo struct {
|
|
|
|
GoOS string `json:"go_os"`
|
|
|
|
GoVersion string `json:"go_version"`
|
|
|
|
GoArch string `json:"go_arch"`
|
|
|
|
CloudflaredVersion string `json:"cloudflared_version"`
|
|
|
|
}
|
|
|
|
|
|
|
|
func GetBuildInfo(cloudflaredVersion string) *BuildInfo {
|
|
|
|
return &BuildInfo{
|
|
|
|
GoOS: runtime.GOOS,
|
|
|
|
GoVersion: runtime.Version(),
|
|
|
|
GoArch: runtime.GOARCH,
|
|
|
|
CloudflaredVersion: cloudflaredVersion,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-25 06:55:13 +00:00
|
|
|
func (bi *BuildInfo) Log(log *zerolog.Logger) {
|
|
|
|
log.Info().Msgf("Version %s", bi.CloudflaredVersion)
|
|
|
|
log.Info().Msgf("GOOS: %s, GOVersion: %s, GoArch: %s", bi.GoOS, bi.GoVersion, bi.GoArch)
|
2019-06-17 21:18:47 +00:00
|
|
|
}
|