config

package
v0.0.0-...-a5914f9 Latest Latest
Warning

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

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

README

Configuring the Service

TODO: Explain each aspect of the config file.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddSource

func AddSource(newSource Source) error

func GetConfig

func GetConfig() *viper.Viper

func Init

func Init(userFlags map[string]interface{})

Types

type EventHandler

type EventHandler struct {
	Notify  bool            `mapstructure:"notify"`
	Actions []ExecuteAction `mapstructure:"actions"`
}

func (EventHandler) Validate

func (e EventHandler) Validate() error

type Events

type Events struct {
	// OnChange event handler, information about what to do when the address updates
	OnChange *EventHandler `mapstructure:"on_change"` // ! nil if it does not exist
	// OnMatch event handler, information about what to do when the address matches the previous
	OnMatch *EventHandler `mapstructure:"on_match"`
	// OnError event handler, information about what to do when an error occurs
	OnError *EventHandler `mapstructure:"on_error"`
}

type ExecuteAction

type ExecuteAction struct {
	Type string `mapstructure:"type"`
	Bin  string `mapstructure:"bin"`
	Args string `mapstructure:"args"`
	TTL  int    `mapstructure:"ttl"`
}

func (ExecuteAction) CheckInstalled

func (s ExecuteAction) CheckInstalled() bool

func (ExecuteAction) Command

func (ExecuteAction) String

func (s ExecuteAction) String() string

func (ExecuteAction) Validate

func (s ExecuteAction) Validate() error

type Source

type Source struct {
	Name  string    `mapstructure:"name"`
	Url   SourceUrl `mapstructure:"url"`
	Type  string    `mapstructure:"type"`
	Field *string   `mapstructure:"field"`
}

type SourceUrl

type SourceUrl struct {
	V4 *string `mapstructure:"v4"`
	V6 *string `mapstructure:"v6"`
}

func (SourceUrl) GetUrl

func (s SourceUrl) GetUrl(version string) (string, error)

Jump to

Keyboard shortcuts

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