app

package
v1.0.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	ProfilingEndpoint = "localhost:9091"
)
View Source
const (
	WorkerConcurrency = 1
)

Variables

View Source
var (
	ErrAppInit = errors.New("error initializing app")
)
View Source
var (
	ErrConfig = errors.New("configuration error")
)

Functions

This section is empty.

Types

type App

type App struct {

	// Flasher configuration.
	Config *Configuration
	// Logger is the app logger
	Logger *logrus.Logger
	// Kind is the type of application - worker
	Kind model.AppKind
	// contains filtered or unexported fields
}

Config holds configuration data when running mctl App holds attributes for the mtl application

func New

func New(appKind model.AppKind, storeKind model.StoreKind, cfgFile, loglevel string, profiling bool) (*App, <-chan os.Signal, error)

New returns returns a new instance of the flasher app

func (*App) LoadConfiguration

func (a *App) LoadConfiguration(cfgFile string, storeKind model.StoreKind) error

LoadConfiguration loads application configuration

Reads in the cfgFile when available and overrides from environment variables.

type Configuration

type Configuration struct {
	// LogLevel is the app verbose logging level.
	// one of - info, debug, trace
	LogLevel string `mapstructure:"log_level"`

	// AppKind is the application kind - worker / client
	AppKind model.AppKind `mapstructure:"app_kind"`

	// Worker configuration
	Concurrency int `mapstructure:"concurrency"`

	// FacilityCode limits this flasher to events in a facility.
	FacilityCode string `mapstructure:"facility_code"`

	// The inventory source - one of serverservice OR Yaml
	InventorySource string `mapstructure:"inventory_source"`

	StoreKind model.StoreKind `mapstructure:"store_kind"`

	// ServerserviceOptions defines the serverservice client configuration parameters
	//
	// This parameter is required when StoreKind is set to serverservice.
	ServerserviceOptions *ServerserviceOptions `mapstructure:"serverservice"`

	// EventsBrokerKind indicates the kind of event broker configuration to enable,
	//
	// Supported parameter value - nats
	EventsBorkerKind string `mapstructure:"events_broker_kind"`

	// NatsOptions defines the NATs events broker configuration parameters.
	//
	// This parameter is required when EventsBrokerKind is set to nats.
	NatsOptions *events.NatsOptions `mapstructure:"nats"`
}

Config holds application configuration read from a YAML or set by env variables.

nolint:govet // prefer readability over field alignment optimization for this case.

type ServerserviceOptions

type ServerserviceOptions struct {
	EndpointURL            *url.URL
	FacilityCode           string   `mapstructure:"facility_code"`
	Endpoint               string   `mapstructure:"endpoint"`
	OidcIssuerEndpoint     string   `mapstructure:"oidc_issuer_endpoint"`
	OidcAudienceEndpoint   string   `mapstructure:"oidc_audience_endpoint"`
	OidcClientSecret       string   `mapstructure:"oidc_client_secret"`
	OidcClientID           string   `mapstructure:"oidc_client_id"`
	OutofbandFirmwareNS    string   `mapstructure:"outofband_firmware_ns"`
	AssetStateAttributeNS  string   `mapstructure:"device_state_attribute_ns"`
	AssetStateAttributeKey string   `mapstructure:"device_state_attribute_key"`
	OidcClientScopes       []string `mapstructure:"oidc_client_scopes"`
	DeviceStates           []string `mapstructure:"device_states"`
	DisableOAuth           bool     `mapstructure:"disable_oauth"`
}

ServerserviceOptions defines configuration for the Serverservice client. https://github.com/metal-toolbox/hollow-serverservice

Jump to

Keyboard shortcuts

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