✨ Separate formatters in config
This commit is contained in:
parent
99f6dc3f8c
commit
da3b524925
6 changed files with 56 additions and 11 deletions
|
|
@ -32,6 +32,7 @@ func Load() (Config, error) {
|
|||
}
|
||||
env.Parse(&c)
|
||||
c.Outputs["stdout"] = loadStdout(c.Outputs["stdout"])
|
||||
c.Formatters["json"] = loadJsonFormat(c.Formatters["json"])
|
||||
|
||||
l := ""
|
||||
for k, v := range Overrides {
|
||||
|
|
@ -77,3 +78,21 @@ func (oo Outputs) Stdout() (s Stdout, enabled bool) {
|
|||
|
||||
return
|
||||
}
|
||||
|
||||
func loadJsonFormat(c map[string]any) map[string]any {
|
||||
jf := JsonFormat{}
|
||||
mapst.Decode(c, &jf)
|
||||
env.Parse(&jf)
|
||||
mapst.Decode(jf, &c)
|
||||
return c
|
||||
}
|
||||
|
||||
func (ff Formatters) Json() (jf JsonFormat) {
|
||||
o, ok := ff["json"]
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
mapst.Decode(o, &jf)
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue