mirror of
https://github.com/kairos-io/kairos-agent.git
synced 2025-09-10 21:39:12 +00:00
* 🌱 Return configuration data from the agent Signed-off-by: Ettore Di Giacinto <mudler@users.noreply.github.com> * 🤖 Cover query by tests Signed-off-by: Ettore Di Giacinto <mudler@users.noreply.github.com> Signed-off-by: Ettore Di Giacinto <mudler@users.noreply.github.com>
43 lines
707 B
Go
43 lines
707 B
Go
package config
|
|
|
|
type Options struct {
|
|
ScanDir []string
|
|
BootCMDLineFile string
|
|
MergeBootCMDLine bool
|
|
NoLogs bool
|
|
}
|
|
|
|
type Option func(o *Options) error
|
|
|
|
var NoLogs Option = func(o *Options) error {
|
|
o.NoLogs = true
|
|
return nil
|
|
}
|
|
|
|
func (o *Options) Apply(opts ...Option) error {
|
|
for _, oo := range opts {
|
|
if err := oo(o); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
var MergeBootLine = func(o *Options) error {
|
|
o.MergeBootCMDLine = true
|
|
return nil
|
|
}
|
|
|
|
func WithBootCMDLineFile(s string) Option {
|
|
return func(o *Options) error {
|
|
o.BootCMDLineFile = s
|
|
return nil
|
|
}
|
|
}
|
|
func Directories(d ...string) Option {
|
|
return func(o *Options) error {
|
|
o.ScanDir = d
|
|
return nil
|
|
}
|
|
}
|