envconst dump command (untested)

refs #186
This commit is contained in:
Christian Schwarz 2019-08-19 18:01:46 +02:00
parent b8d9f4ba92
commit 348ecde574

View File

@ -9,6 +9,16 @@ import (
var cache sync.Map
// capture the actual envconst values used at runtime
func DebugDump() map[string]interface{} {
m := make(map[string]interface{})
cache.Range(func(k, v interface{}) bool {
m[k.(string)] = v
return true
})
return m
}
func Duration(varname string, def time.Duration) time.Duration {
if v, ok := cache.Load(varname); ok {
return v.(time.Duration)