my-log/config/types.go

36 lines
503 B
Go
Raw Normal View History

package config
2024-02-09 09:44:35 -06:00
import mapst "github.com/mitchellh/mapstructure"
type Config struct {
Input Input
2024-02-09 09:44:35 -06:00
Outputs Outputs `toml:"output"`
}
type Input struct {
Path string
Recurse bool
Ext string
}
2024-02-09 09:44:35 -06:00
type Outputs map[string]Output
type Output struct {
Enabled bool
Config map[string]any
}
2024-02-09 09:44:35 -06:00
func (oo Outputs) Stdout() (s Stdout, enabled bool) {
o, ok := oo["stdout"]
if !ok {
return s, false
}
enabled = o.Enabled
mapst.Decode(o.Config, &s)
return
}
type Stdout struct {
Json bool
}