mirror of
https://github.com/status-im/consul.git
synced 2025-01-10 13:55:55 +00:00
Add build date to self endpoint
Signed-off-by: Mark Anderson <manderson@hashicorp.com>
This commit is contained in:
parent
ec060e5e37
commit
19c87be3a6
@ -91,6 +91,7 @@ func (s *HTTPHandlers) AgentSelf(resp http.ResponseWriter, req *http.Request) (i
|
||||
Revision string
|
||||
Server bool
|
||||
Version string
|
||||
BuildDate string
|
||||
}{
|
||||
Datacenter: s.agent.config.Datacenter,
|
||||
PrimaryDatacenter: s.agent.config.PrimaryDatacenter,
|
||||
@ -100,8 +101,10 @@ func (s *HTTPHandlers) AgentSelf(resp http.ResponseWriter, req *http.Request) (i
|
||||
Revision: s.agent.config.Revision,
|
||||
Server: s.agent.config.ServerMode,
|
||||
// We expect the ent version to be part of the reported version string, and that's now part of the metadata, not the actual version.
|
||||
Version: s.agent.config.VersionWithMetadata(),
|
||||
Version: s.agent.config.VersionWithMetadata(),
|
||||
BuildDate: s.agent.config.BuildDate.Format(time.RFC3339),
|
||||
}
|
||||
|
||||
return Self{
|
||||
Config: config,
|
||||
DebugConfig: s.agent.config.Sanitized(),
|
||||
|
@ -1701,6 +1701,10 @@ func sanitize(name string, v reflect.Value) reflect.Value {
|
||||
x := v.Interface().(time.Duration)
|
||||
return reflect.ValueOf(x.String())
|
||||
|
||||
case isTime(typ):
|
||||
x := v.Interface().(time.Time)
|
||||
return reflect.ValueOf(x.String())
|
||||
|
||||
case isString(typ):
|
||||
if strings.HasPrefix(name, "RetryJoinLAN[") || strings.HasPrefix(name, "RetryJoinWAN[") {
|
||||
x := v.Interface().(string)
|
||||
@ -1772,6 +1776,7 @@ func sanitize(name string, v reflect.Value) reflect.Value {
|
||||
}
|
||||
|
||||
func isDuration(t reflect.Type) bool { return t == reflect.TypeOf(time.Second) }
|
||||
func isTime(t reflect.Type) bool { return t == reflect.TypeOf(time.Time{}) }
|
||||
func isMap(t reflect.Type) bool { return t.Kind() == reflect.Map }
|
||||
func isNetAddr(t reflect.Type) bool { return t.Implements(reflect.TypeOf((*net.Addr)(nil)).Elem()) }
|
||||
func isPtr(t reflect.Type) bool { return t.Kind() == reflect.Ptr }
|
||||
|
Loading…
x
Reference in New Issue
Block a user