35 lines
597 B
Go
35 lines
597 B
Go
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,
|
|
}
|
|
}
|