app

package
v0.2024.4 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2024 License: GPL-3.0 Imports: 45 Imported by: 0

Documentation

Overview

Package app handles service lifecycle management, and other functionality necessary for the daemon-style server applications in this project.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunUntilInterrupt

func RunUntilInterrupt(run func(ctx context.Context) error) (status int)

RunUntilInterrupt will run the function with a context which is cancelled when the process receives a SIGINT. If the function returns an error, it is printed to os.Stderr and the process will exit with a nonzero status code. There is special handling for errors from the multierr package; each error will be printed on its own line.

func ServeGRPC

func ServeGRPC(ctx context.Context, server *grpc.Server, listen string, timeout time.Duration, logger *zap.Logger) error

func ServeHTTPS

func ServeHTTPS(ctx context.Context, server *http.Server, timeout time.Duration, logger *zap.Logger) error

Types

type Controller

type Controller struct {
	SystemConfig     sysconf.Config
	ControllerConfig appconf.Config
	Enrollment       *enrollment.Server

	// services for drivers/automations
	Logger          *zap.Logger
	Node            *node.Node
	Tasks           *task.Group
	Database        *bolthold.Store
	TokenValidators *token.ValidatorSet
	GRPCCerts       *pki.SourceSet

	Mux  *http.ServeMux
	GRPC *grpc.Server
	HTTP *http.Server

	PrivateKey      pki.PrivateKey
	ClientTLSConfig *tls.Config
	ManagerConn     node.Remote
	// contains filtered or unexported fields
}

func Bootstrap

func Bootstrap(ctx context.Context, config sysconf.Config) (*Controller, error)

Bootstrap will obtain a Controller in a ready-to-run state.

func (*Controller) Defer

func (c *Controller) Defer(d Deferred)

Defer indicates that the given Deferred should be executed when the Controllers Run method returns.

func (*Controller) Run

func (c *Controller) Run(ctx context.Context) (err error)

type Deferred

type Deferred func() error

type VersionInfo

type VersionInfo struct {
	*debug.BuildInfo
}
var Version VersionInfo

func (VersionInfo) ServeHTTP

func (v VersionInfo) ServeHTTP(w http.ResponseWriter, request *http.Request)

Directories

Path Synopsis
Package appconf provides runtime configuration.
Package appconf provides runtime configuration.
Package files provides file utilities.
Package files provides file utilities.
Package http provides http-specific configuration types and functionality.
Package http provides http-specific configuration types and functionality.
Package sysconf provides system level configuration.
Package sysconf provides system level configuration.

Jump to

Keyboard shortcuts

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