config

package
v0.0.0-...-041f5a1 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitPlugins

func InitPlugins() error

InitPlugins calls the Init() function on any enabled notifiers and databases

func PrintSampleConfig

func PrintSampleConfig()

PrintSampleConfig prints the sample config

func PrintSetupConfig

func PrintSetupConfig(db string) string

PrintSetupConfig returns a version of the config ready for substitution by the setup process

Types

type Config

type Config struct {
	Options    *OptionsConfig
	WebOptions *WebOptionsConfig

	Notifiers []*models.ActiveNotifier
	Databases []*models.ActiveDatabase
}

Config - struct to hold the values read from the config file

var Conf *Config

func NewConfig

func NewConfig() *Config

NewConfig provides base config options that get replaced by the TOML options

func (*Config) DatabaseNames

func (c *Config) DatabaseNames() []string

DatabaseNames returns a list of all configured databases

func (*Config) GetConfig

func (c *Config) GetConfig(config string) error

GetConfig reads and parses the config

func (*Config) NotifierNames

func (c *Config) NotifierNames() []string

NotifierNames returns a list of all configured notifiers

type OptionsConfig

type OptionsConfig struct {
	// Interval on which to check in minutes
	Interval helpers.Duration
	// Verbose controls whether check output will be logged, and how much will be logged to stdout
	Verbose bool

	// Timeout for each check
	Timeout helpers.Duration
}

OptionsConfig - General system options such as check interval

type WebOptionsConfig

type WebOptionsConfig struct {
	// IP to listen on
	IP string
	// Port to use for non-SSL connections
	HTTPPort int `toml:"http_port"`
	// Port to use for SSL connections
	HTTPSPort int `toml:"https_port"`

	// TLS settings. Cert, key, and whether to listen on SSL
	TLSCert string `toml:"tls_cert"`
	TLSKey  string `toml:"tls_key"`
	SSL     bool
	// Redirect to SSL
	Redirect bool
	// Allow the REST API to be accessible
	ExposeAPI bool `toml:"expose_api"`
	// IP to listen for API connections on
	APIIP string `toml:"api_ip"`
	// Port to listen for API connections on
	APIPort int `toml:"api_port"`

	// Web interface branding
	Title  string
	NavBar string `toml:"nav_bar"`
}

WebOptionsConfig - Options related to the web interface

Jump to

Keyboard shortcuts

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