config

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RenderConfig

func RenderConfig(config *InitConfig) error

Types

type Condition

type Condition struct {
	NotifyOnFailure bool
	ResolvedSignal  string
	IgnoreResolved  bool
	Labels          map[string]string
}

type Config

type Config struct {
	ListenAddr string             `yaml:"listen_address"`
	Verbose    bool               `yaml:"verbose"`
	TLSKey     string             `yaml:"tls_key"`
	TLSCrt     string             `yaml:"tls_crt"`
	Commands   []*command.Command `yaml:"commands"`
}

Config represents the configuration for this program

func ReadConfig

func ReadConfig(configFile string) (*Config, error)

readConfig reads configuration from supported means (cli flags, config file), validates parameters and returns a Config struct.

func (*Config) HasCommand

func (c *Config) HasCommand(other *command.Command) bool

HasCommand returns true if the config contains the given Command

type ConsulConfig

type ConsulConfig struct {
	Address string
}

type InitCommand

type InitCommand struct {
	Cmd             string            `yaml:"cmd"`
	Args            []string          `yaml:"args,omitempty"`
	MatchLabels     map[string]string `yaml:"match_labels,omitempty"`
	NotifyOnFailure bool              `yaml:"notify_on_failure"`
	ResolvedSignal  string            `yaml:"resolved_signal,omitempty"`
	IgnoreResolved  bool              `yaml:"ignore_resolved,omitempty"`
	Max             int               `yaml:"max,omitempty"`
}

type InitConfig

type InitConfig struct {
	Server *Server
	Tasks  []*Task
}

func LoadConfig

func LoadConfig(configPath string) (*InitConfig, error)

type Server

type Server struct {
	Listen          string
	DataDir         string
	LogLevel        string
	TerraformDriver string
	Consul          ConsulConfig
}

type Task

type Task struct {
	Name        string
	Description string
	Source      string
	Condition   Condition
}

type YAMLConfig

type YAMLConfig struct {
	ListenAddress string        `yaml:"listen_address"`
	Verbose       bool          `yaml:"verbose"`
	TLSKey        string        `yaml:"tls_key,omitempty"`
	TLSCrt        string        `yaml:"tls_crt,omitempty"`
	Commands      []InitCommand `yaml:"commands"`
}

Jump to

Keyboard shortcuts

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