Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LogFactGathered ¶
LogFactGathered logs the details of a fact that has been gathered.
Types ¶
type Action ¶
type Action struct { Command string `validate:"required"` // action command Rules []string // action rules }
Format provides a data format for the actions defined in the configuration file.
type Config ¶
type Config struct { Daemon Daemon `validate:"dive"` Logging system.LogConfig `validate:"dive"` Facts []Fact `validate:"dive"` // facts slice Actions []Action `validate:"required,dive"` // actions slice Hash uint32 }
Config provides a data format for the configuration file.
func LoadConfigFile ¶
LoadConfigFile loads a configuration file, validates it, and returns the resulting Config.
func Run ¶
Run executes all the actions defined in the configuration file. It loads the configuration from the specified file and merges it with the provided merge configuration. It initializes logging and gathers facts before executing the actions.
Parameters: - configFile: The path to the configuration file. - merge: The merge configuration to combine with the loaded configuration.
notest
func (*Config) CalculateHash ¶
func (c *Config) CalculateHash()
CalculateHash calculates a Adler-32 hash from the Config struct
type Daemon ¶
type Daemon struct {
Interval string `validate:"duration"`
}
Daemon provides a data format for daemon settings defined in the configuration file.
type DurationValidator ¶
type DurationValidator struct {
// contains filtered or unexported fields
}
DurationValidator is a custom validator for duration strings.
func (*DurationValidator) Validate ¶
func (v *DurationValidator) Validate(fl validator.FieldLevel) bool
Validate is the validation method for duration strings. It checks if the duration string is valid by attempting to parse it using time.ParseDuration().