load jobinfo secrets only on demand

This commit is contained in:
Bel LaPointe
2022-01-14 08:23:56 -05:00
parent 84217c75e8
commit 8f5ebecee8
2 changed files with 24 additions and 14 deletions

View File

@@ -16,6 +16,7 @@ type Job struct {
Weight int
Miles int
Meta string
secrets func() interface{} `json:"-"`
}
type JobLocation struct {
@@ -24,6 +25,18 @@ type JobLocation struct {
State string
}
func (j *Job) Secrets() {
if j.secrets == nil {
return
}
v := j.secrets()
j.secrets = nil
if v == nil {
return
}
j.Meta = fmt.Sprintf("%s %+v", j.Meta, v)
}
func (j Job) String() string {
return fmt.Sprintf(
`%s => %s (%d miles), Weight:%d, Notes:%s Link:%s`,