config

package
v0.0.0-...-efb87f3 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultPath is the default location for the config file.
	DefaultPath = "/etc/gansoi.yml"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Configuration

type Configuration struct {
	Bind             string                          `json:"bind"`
	DataDir          string                          `json:"datadir"`
	HTTP             HTTP                            `json:"http"`
	HTTPRedirect     HTTPRedirect                    `json:"redirect"`
	ExclusiveSeeding bool                            `json:"exclusive-seeding"`
	Hosts            map[string]ssh.SSH              `json:"hosts"`
	Checks           map[string]*checks.Check        `json:"checks"`
	ContactGroups    map[string]*notify.ContactGroup `json:"contactgroups"`
	Contacts         map[string]*notify.Contact      `json:"contacts"`
	// contains filtered or unexported fields
}

Configuration keeps configuration for a core node.

func NewConfiguration

func NewConfiguration() *Configuration

NewConfiguration returns a new configuration with sane defaults.

func (*Configuration) DeleteUnknownSeeds

func (c *Configuration) DeleteUnknownSeeds(db database.ReadWriter)

DeleteUnknownSeeds deletes all checks, hosts, contacts and contactgroups not seeded from the configuration.

func (*Configuration) LoadFromFile

func (c *Configuration) LoadFromFile(path string) error

LoadFromFile loads a configuration from path.

func (*Configuration) SaveChecks

func (c *Configuration) SaveChecks(w database.Writer) error

SaveChecks will save all checks from the configuration to the supplied database.Writer.

func (*Configuration) SaveContactGroups

func (c *Configuration) SaveContactGroups(w database.Writer) error

func (*Configuration) SaveContacts

func (c *Configuration) SaveContacts(w database.Writer) error

func (*Configuration) SaveHosts

func (c *Configuration) SaveHosts(w database.Writer) error

SaveHosts will save all hosts from the configuration to the supplied database.Writer.

type HTTP

type HTTP struct {
	TLS       bool     `json:"tls"`
	Bind      string   `json:"bind"`
	Hostnames []string `json:"hostnames"`
	CertPath  string   `json:"cert"`
	KeyPath   string   `json:"key"`
	Login     string   `json:"login"`
	Password  string   `json:"password"`
}

HTTP configures the HTTP server.

type HTTPRedirect

type HTTPRedirect struct {
	Bind   string `json:"bind"`
	Target string `json:"target"`
}

HTTPRedirect is the configuration for a HTTP redirector.

Jump to

Keyboard shortcuts

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