mirror of
https://github.com/kairos-io/kairos-agent.git
synced 2025-06-03 01:44:53 +00:00

This changeset also adds a `config_url` and `options` keyword in the c3os config. Along with that the config logic is changed so the configuration is taken also from boot commands and merged in the final installed config file.
37 lines
607 B
Go
37 lines
607 B
Go
package config
|
|
|
|
type Options struct {
|
|
ScanDir []string
|
|
BootCMDLineFile string
|
|
MergeBootCMDLine bool
|
|
}
|
|
|
|
type Option func(o *Options) error
|
|
|
|
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
|
|
}
|
|
}
|