daemon

package
v0.0.0-...-800adf3 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2022 License: ISC Imports: 17 Imported by: 5

Documentation

Index

Constants

View Source
const (
	DefaultAPIAddress = "localhost:4196"
)

Variables

View Source
var TemplateFuncMap = map[string]interface{}{
	"env": func(name string) string {
		return os.Getenv(name)
	},
}

Functions

func LoadCfg

func LoadCfg(filePath string, dest interface{}) error

func RenderCfg

func RenderCfg(data []byte) ([]byte, error)

func Run

func Run(name, description string, service Service)

func RunTest

func RunTest(name string, service Service, cfgPath string, readyChan chan<- struct{})

func YAMLValueToJSONValue

func YAMLValueToJSONValue(yamlValue interface{}) (interface{}, error)

Types

type APICfg

type APICfg struct {
	Address string `json:"address"`
}

func (*APICfg) Check

func (cfg *APICfg) Check(c *check.Checker)

type Daemon

type Daemon struct {
	Cfg DaemonCfg

	Log *dlog.Logger

	HTTPServers map[string]*dhttp.Server
	HTTPClients map[string]*dhttp.Client

	Influx *influx.Client

	Pg *pg.Client

	Hostname string
	// contains filtered or unexported fields
}

type DaemonCfg

type DaemonCfg struct {
	Logger *dlog.LoggerCfg

	API *APICfg

	HTTPServers map[string]dhttp.ServerCfg
	HTTPClients map[string]dhttp.ClientCfg

	Influx *influx.ClientCfg

	Pg *pg.ClientCfg
	// contains filtered or unexported fields
}

func NewDaemonCfg

func NewDaemonCfg() DaemonCfg

func (DaemonCfg) AddHTTPClient

func (cfg DaemonCfg) AddHTTPClient(name string, clientCfg dhttp.ClientCfg)

func (DaemonCfg) AddHTTPServer

func (cfg DaemonCfg) AddHTTPServer(name string, serverCfg dhttp.ServerCfg)

type Service

type Service interface {
	DefaultServiceCfg() interface{}
	ValidateServiceCfg() error
	DaemonCfg() (DaemonCfg, error)
	Init(*Daemon) error
	Start(*Daemon) error
	Stop(*Daemon)
	Terminate(*Daemon)
}

Jump to

Keyboard shortcuts

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