viper

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultConfigFile = "config.yaml"
)

Variables

View Source
var (
	ErrorConfigNotFound = fmt.Errorf("the config at '%s' was not found", DefaultConfigFile)
	DefaultConfig       = Config{
		NutServers: []NutServer{
			{
				Name:     "NUT Server 1",
				Host:     "192.168.1.13",
				Port:     entity.DefaultNUTServerPort,
				Username: "",
				Password: "",
				Targets: []TargetServer{
					{
						Name:      "NAS 1",
						MAC:       "00:00:00:00:00:00",
						Broadcast: "192.168.1.255",
						Port:      entity.DefaultWoLPort,
						Interval:  "15m",
						Rules: []string{
							"80percentOn.rego",
						},
					},
				},
			},
		},
	}
)

Functions

func CreateDefaultConfig

func CreateDefaultConfig() (*entity.Config, error)

func Load

func Load() (*entity.Config, error)

Types

type Config

type Config struct {
	NutServers []NutServer `mapstructure:"nut_servers"`
}

type NutServer

type NutServer struct {
	Name     string         `mapstructure:"name"`
	Host     string         `mapstructure:"host"`
	Port     int            `mapstructure:"port"`
	Username string         `mapstructure:"username"`
	Password string         `mapstructure:"password"`
	Targets  []TargetServer `mapstructure:"targets"`
}

type TargetServer

type TargetServer struct {
	Name      string   `mapstructure:"name"`
	MAC       string   `mapstructure:"mac"`
	Broadcast string   `mapstructure:"broadcast"`
	Port      int      `mapstructure:"port" default:"9"`
	Interval  string   `mapstructure:"interval" default:"15m"`
	Rules     []string `mapstructure:"rules"`
}

Jump to

Keyboard shortcuts

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