config

package
v0.0.0-...-2838e73 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package config provides a configuration interface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

type Builder struct {
	Configs map[string]interface{}
	Type    string
}

Builder is the builder config to build a notifier or handler.

func (Builder) BuildEmailHandler

func (b Builder) BuildEmailHandler() (email.Handler, error)

BuildEmailHandler builds an email handler.

func (Builder) BuildNotifier

func (b Builder) BuildNotifier() (notice.Notifier, error)

BuildNotifier builds a notifier.

type Controller

type Controller struct {
	Delay    int64
	Timeout  int64
	Interval int64

	Email     Email
	Handlers  []Builder
	Notifiers []Builder
}

Controller is the controller config.

func (Controller) Controller

func (c Controller) Controller() (*controller.Controller, error)

Controller creates a controller with itself.

func (Controller) Options

func (c Controller) Options() ([]controller.Option, error)

Options converts itself to controller options.

type Email

type Email struct {
	Address  string `validate:"required"`
	Username string `validate:"required"`
	Password string `validate:"required"`
	Number   uint32
	UseTLS   bool `json:"UseTls"`

	SkipTLSVerify bool `validate:"SkipTlsVerify"`
}

Email is the email config.

func (Email) ControllerOptoin

func (e Email) ControllerOptoin() controller.Option

ControllerOptoin converts itself to the controller option.

type Loader

type Loader interface {
	LoadController() ([]Controller, error)
}

Loader is used to load the config.

func FileLoader

func FileLoader(filepath string) Loader

FileLoader returns a file loader to load the config from the given file.

Jump to

Keyboard shortcuts

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