config

package
v0.0.0-...-d04f0d8 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(in []ServerOrGroup, ctx Context, out *chihuahua.ServerOrGroup)

func New

func New() *chihuahua.Config

func Parse

func Parse(path string, cfg *chihuahua.Config) error

func Setup

func Setup(sourcePath string, watch bool) *chihuahua.Config

func Watch

func Watch(sourcePath string, targetStruct *chihuahua.Config) error

Types

type Check

type Check struct {
	ID      string  `hcl:"id,label"`
	Name    *string `hcl:"name"`
	Command string  `hcl:"command"`

	Disable  *bool     `hcl:"disable"`
	Notify   *[]string `hcl:"notify"`
	Verify   *uint     `hcl:"verify"`
	Interval *string   `hcl:"interval"`
	// contains filtered or unexported fields
}

func (Check) Convert

func (in Check) Convert(out *chihuahua.Check, ctx Context)

type Config

type Config struct {
	Check    []Check         `hcl:"check,block"`
	Group    []ServerOrGroup `hcl:"group,block"`
	Server   []ServerOrGroup `hcl:"server,block"`
	Notifier []Notifier      `hcl:"notifier,block"`

	RootURL *string `hcl:"root_url"`

	Disable  *bool     `hcl:"disable"`
	Notify   *[]string `hcl:"notify"`
	Verify   *uint     `hcl:"verify"`
	Interval *string   `hcl:"interval"`
	// contains filtered or unexported fields
}

type Context

type Context struct {
	Parent   []string
	Disable  bool
	Notify   []string
	Verify   uint
	Interval time.Duration
	Checks   []Check
}

type Empty

type Empty struct{}

Server and Group exist just to check if there are any invalid fields

type Notifier

type Notifier struct {
	ID      string           `hcl:"id,label"`
	Type    string           `hcl:"type"`
	Filters []NotifierFilter `hcl:"filter,block"`
	Remain  hcl.Body         `hcl:",remain"`
}

type NotifierFilter

type NotifierFilter struct {
	If     string `hcl:"id,label"`
	Accept *bool  `hcl:"accept"`
}

type ServerOrGroup

type ServerOrGroup struct {
	ID         string  `hcl:"id,label"`
	Name       *string `hcl:"name"`
	Connection *string `hcl:"connection"`

	Disable  *bool     `hcl:"disable"`
	Notify   *[]string `hcl:"notify"`
	Verify   *uint     `hcl:"verify"`
	Interval *string   `hcl:"interval"`

	Check  []Check         `hcl:"check,block"`
	Group  []ServerOrGroup `hcl:"group,block"`
	Server []ServerOrGroup `hcl:"server,block"`

	Info hcl.Body `hcl:",remain"`
	// contains filtered or unexported fields
}

func Merge

func Merge(servers []ServerOrGroup, groups []ServerOrGroup) ([]ServerOrGroup, error)

Jump to

Keyboard shortcuts

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