This commit is contained in:
34
internal/config/version.go
Normal file
34
internal/config/version.go
Normal file
@@ -0,0 +1,34 @@
|
||||
package config
|
||||
|
||||
import "fmt"
|
||||
|
||||
type Version struct {
|
||||
Release string
|
||||
Commit string
|
||||
Date string
|
||||
}
|
||||
|
||||
var (
|
||||
release = "dev"
|
||||
commit = ""
|
||||
date = ""
|
||||
)
|
||||
|
||||
func (v *Version) AppNameAndVersion(details bool) string {
|
||||
result := fmt.Sprintf("Basin Feature Flag Service %s", v.Release)
|
||||
if details && v.Commit != "" {
|
||||
result = fmt.Sprintf("%s\nGit commit: %s", result, v.Commit)
|
||||
}
|
||||
if details && v.Date != "" {
|
||||
result = fmt.Sprintf("%s\nBuilt at: %s", result, v.Date)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
func NewVersion() Version {
|
||||
return Version{
|
||||
Release: release,
|
||||
Commit: commit,
|
||||
Date: date,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user