app

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const AppName = "component_inventory"

XXX: be careful here. Compound names need to be valid prometheus metric names (used in internal/metrics.go)

Variables

This section is empty.

Functions

func GetLogger

func GetLogger(dev bool) *zap.Logger

GetLogger constructs a new logger for composition within an App

Types

type App

type App struct {
	Log *zap.Logger
	Cfg *Configuration
	// contains filtered or unexported fields
}

func NewApp

func NewApp(ctx context.Context, cfg *Configuration, log *zap.Logger, opts ...Option) *App

NewApp composes the provided Configuration and Logger into a new App object

func (*App) ContextDone

func (a *App) ContextDone() bool

ContextDone indicates whether an App's internal context has expired or been canceled We cancel the internal context on SIGTERM or SIGINT to signal anything interested that it's time to go.

func (*App) LogRunningConfig

func (a *App) LogRunningConfig()

LogRunningConfig does exactly what it says on the tin. It is only a side-effect.

func (*App) WaitForSignal

func (a *App) WaitForSignal()

WaitForSignal blocks on the Server's internal signal channel until we catch SIGTERM or SIGINT

type Configuration

type Configuration struct {
	ListenAddress  string              `mapstructure:"listen_address"`
	DeveloperMode  bool                `mapstructure:"developer_mode"`
	JWTAuth        []ginjwt.AuthConfig `mapstructure:"ginjwt_auth"`
	FleetDBAddress string              `mapstructure:"fleetdb_address"`
	FleetDBToken   string              `mapstructure:"fleetdb_token"`
}

func LoadConfiguration

func LoadConfiguration(cfgFile string) (*Configuration, error)

LoadConfiguration opens and parses the configuration file and then applies any environmental overrides

type Option

type Option func(*App)

Option provides a path for adding arbitrary stuff to an App.

func NewOption

func NewOption(key string, opt any) Option

New Option composes a generic Option for an App.

Jump to

Keyboard shortcuts

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