config

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 22, 2024 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ModulesOrder = []string{
		"ansible",
		"base",
		"corosync",
		"elastic",
		"foreman",
		"grafana",
		"graphite",
		"graylog",
		"icinga-director",
		"icinga2",
		"icingadb",
		"icingaweb2",
		"influxdb",
		"keepalived",
		"mongodb",
		"mysql",
		"postgresql",
		"prometheus",
		"puppet",
		"redis",
		"webservers",
	}
)

Functions

func GenerateDefaultAnswerFile

func GenerateDefaultAnswerFile() error

GenerateDefaultAnswerFile creates a new answer-file with default values in current dir

func ReadAnswerFile

func ReadAnswerFile(answerFile string, conf *Config) error

ReadAnswerFile reads given values from answerFile and returns new Config

func ValidateConfig

func ValidateConfig(conf Config) (errors []error)

ValidateConfig validates the given config.Config for errors. Returns []error

Types

type Config

type Config struct {
	General General `yaml:"general" json:"general"`
	Icinga2 Icinga2 `yaml:"icinga2" json:"icinga2"`
}

func GetControlDefaultObject

func GetControlDefaultObject() Config

GetControlDefaultObject returns a new Config object with some pre-defined default values

type General

type General struct {
	OutputFile         string        `yaml:"outputFile" json:"outputFile"`
	AnswerFile         string        `yaml:"answerFile,omitempty" json:"answerFile,omitempty"`
	EnabledModules     []string      `yaml:"enabledModules" json:"enabledModules"`
	DisabledModules    []string      `yaml:"disabledModules" json:"disabledModules"`
	ExtraObfuscators   []string      `yaml:"extraObfuscators" json:"extraObfuscators"`
	DetailedCollection bool          `yaml:"detailedCollection" json:"detailedCollection"`
	CommandTimeout     time.Duration `yaml:"commandTimeout" json:"commandTimeout"`
}

type Icinga2

type Icinga2 struct {
	Endpoints []icingaapi.Endpoint `yaml:"endpoints" json:"endpoints"`
}

type Wizard

type Wizard struct {
	Scanner   *bufio.Scanner
	Arguments []argument
}

func NewWizard

func NewWizard() Wizard

NewWizard creates a new Wizard

func (*Wizard) AddBoolVar

func (w *Wizard) AddBoolVar(callback *bool, name string, defaultValue bool, usage string, dependency func() bool)

AddBoolVar adds argument for a boolean variable

callback: Variable to save the input to
name: Internal name
defaultValue: Default
usage: usage string
dependency: Add dependency function to validate if that argument will be added or not

func (*Wizard) AddIcingaEndpoints

func (w *Wizard) AddIcingaEndpoints(callback *[]icingaapi.Endpoint, name, usage string, dependency func() bool)

func (*Wizard) AddSliceVarFromString

func (w *Wizard) AddSliceVarFromString(callback *[]string, name string, defaultValue []string, usage string, required bool, dependency func() bool)

AddSliceVarFromString reads a single string from stdin. This string will be separated by ',' and the resulting slice will be returned

callback: Variable to save the input to
name: Internal name
defaultValue: Default
usage: usage string
required: bool
dependency: Add dependency function to validate if that argument will be added or not

func (*Wizard) AddStringSliceVar

func (w *Wizard) AddStringSliceVar(callback *[]string, name string, defaultValue bool, initialPrompt string, inputPrompt string, dependency func() bool)

AddStringSliceVar adds argument for a slice of strings.

callback: Variable to save the input to
name: Internal name
defaultValue: Should that slice be collected via default?
initialPrompt: The initial stdout message to ask if you want to collect
inputPrompt: The recurring stdout message for each slice
dependency: Add dependency function to validate if that argument will be added or not

func (*Wizard) AddStringVar

func (w *Wizard) AddStringVar(callback *string, name, defaultValue, usage string, required bool, dependency func() bool)

AddStringVar adds argument for a string variable

callback: Variable to save the input to
name: Internal name
defaultValue: Default
usage: usage string
required: bool
dependency: Add dependency function to validate if that argument will be added or not

func (*Wizard) Parse

func (w *Wizard) Parse(availableModules string)

Parse starts the interactive wizard for all Arguments defined in Wizard

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL