Documentation
¶
Index ¶
- func DefaultLogger(clioCfg Config, store redact.Store) (logger.Logger, error)
- func VersionCommand(id Identification) *cobra.Command
- type Application
- type BusConstructor
- type Config
- type DevelopmentConfig
- type Identification
- type Initializer
- type LoggerConstructor
- type LoggingConfig
- type Profile
- type SetupConfig
- func (c *SetupConfig) WithBusConstructor(constructor BusConstructor) *SetupConfig
- func (c *SetupConfig) WithConfigFinders(finders ...fangs.Finder) *SetupConfig
- func (c *SetupConfig) WithConfigInRootHelp() *SetupConfig
- func (c *SetupConfig) WithDevelopmentConfig(cfg DevelopmentConfig) *SetupConfig
- func (c *SetupConfig) WithGlobalConfigFlag() *SetupConfig
- func (c *SetupConfig) WithGlobalLoggingFlags() *SetupConfig
- func (c *SetupConfig) WithInitializers(initializers ...Initializer) *SetupConfig
- func (c *SetupConfig) WithLoggerConstructor(constructor LoggerConstructor) *SetupConfig
- func (c *SetupConfig) WithLoggingConfig(cfg LoggingConfig) *SetupConfig
- func (c *SetupConfig) WithNoBus() *SetupConfig
- func (c *SetupConfig) WithNoLogging() *SetupConfig
- func (c *SetupConfig) WithUI(uis ...UI) *SetupConfig
- func (c *SetupConfig) WithUIConstructor(constructor UIConstructor) *SetupConfig
- type State
- type UI
- type UIConstructor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func VersionCommand ¶
func VersionCommand(id Identification) *cobra.Command
Types ¶
type Application ¶
type Application interface { AddFlags(flags *pflag.FlagSet, cfgs ...any) SetupCommand(cmd *cobra.Command, cfgs ...any) *cobra.Command SetupRootCommand(cmd *cobra.Command, cfgs ...any) *cobra.Command }
func New ¶
func New(cfg SetupConfig) Application
type BusConstructor ¶
type BusConstructor func(Config) *eventbus.Bus
type Config ¶
type Config struct { // Items that end up in the target application configuration Log *LoggingConfig `yaml:"log" json:"log" mapstructure:"log"` Dev *DevelopmentConfig `yaml:"dev" json:"dev" mapstructure:"dev"` // this is a list of all "config" objects from SetupCommand calls FromCommands []any `yaml:"-" json:"-" mapstructure:"-"` }
type DevelopmentConfig ¶
type DevelopmentConfig struct {
Profile Profile `yaml:"profile" json:"profile" mapstructure:"profile"`
}
func (*DevelopmentConfig) DescribeFields ¶
func (d *DevelopmentConfig) DescribeFields(set fangs.FieldDescriptionSet)
func (*DevelopmentConfig) PostLoad ¶
func (d *DevelopmentConfig) PostLoad() error
type Identification ¶
type Identification struct { Name string `json:"application,omitempty"` // application name Version string `json:"version,omitempty"` // application semantic version GitCommit string `json:"gitCommit,omitempty"` // git SHA at build-time GitDescription string `json:"gitDescription,omitempty"` // indication of git tree (either "clean" or "dirty") at build-time BuildDate string `json:"buildDate,omitempty"` // date of the build }
Identification defines the application name and version details (generally from build information)
type Initializer ¶
type LoggingConfig ¶
type LoggingConfig struct { Quiet bool `yaml:"quiet" json:"quiet" mapstructure:"quiet"` // -q, indicates to not show any status output to stderr Verbosity int `yaml:"-" json:"-" mapstructure:"verbosity"` // -v or -vv , controlling which UI (ETUI vs logging) and what the log level should be Level logger.Level `yaml:"level" json:"level" mapstructure:"level"` // the log level string hint FileLocation string `yaml:"file" json:"file" mapstructure:"file"` // the file path to write logs to // contains filtered or unexported fields }
LoggingConfig contains all logging-related configuration options available to the user via the application config.
func (*LoggingConfig) AddFlags ¶
func (l *LoggingConfig) AddFlags(flags fangs.FlagSet)
func (*LoggingConfig) DescribeFields ¶
func (l *LoggingConfig) DescribeFields(d fangs.FieldDescriptionSet)
func (*LoggingConfig) PostLoad ¶
func (l *LoggingConfig) PostLoad() error
type SetupConfig ¶
type SetupConfig struct { // Metadata about the target application ID Identification // Default configuration items that end up in the target application configuration DefaultLoggingConfig *LoggingConfig DefaultDevelopmentConfig *DevelopmentConfig // Items required for setting up the application (clio-only configuration) FangsConfig fangs.Config BusConstructor BusConstructor LoggerConstructor LoggerConstructor UIConstructor UIConstructor Initializers []Initializer // contains filtered or unexported fields }
func NewSetupConfig ¶
func NewSetupConfig(id Identification) *SetupConfig
func (*SetupConfig) WithBusConstructor ¶
func (c *SetupConfig) WithBusConstructor(constructor BusConstructor) *SetupConfig
func (*SetupConfig) WithConfigFinders ¶
func (c *SetupConfig) WithConfigFinders(finders ...fangs.Finder) *SetupConfig
func (*SetupConfig) WithConfigInRootHelp ¶
func (c *SetupConfig) WithConfigInRootHelp() *SetupConfig
func (*SetupConfig) WithDevelopmentConfig ¶
func (c *SetupConfig) WithDevelopmentConfig(cfg DevelopmentConfig) *SetupConfig
func (*SetupConfig) WithGlobalConfigFlag ¶
func (c *SetupConfig) WithGlobalConfigFlag() *SetupConfig
func (*SetupConfig) WithGlobalLoggingFlags ¶
func (c *SetupConfig) WithGlobalLoggingFlags() *SetupConfig
func (*SetupConfig) WithInitializers ¶
func (c *SetupConfig) WithInitializers(initializers ...Initializer) *SetupConfig
func (*SetupConfig) WithLoggerConstructor ¶
func (c *SetupConfig) WithLoggerConstructor(constructor LoggerConstructor) *SetupConfig
func (*SetupConfig) WithLoggingConfig ¶
func (c *SetupConfig) WithLoggingConfig(cfg LoggingConfig) *SetupConfig
func (*SetupConfig) WithNoBus ¶
func (c *SetupConfig) WithNoBus() *SetupConfig
func (*SetupConfig) WithNoLogging ¶
func (c *SetupConfig) WithNoLogging() *SetupConfig
func (*SetupConfig) WithUI ¶
func (c *SetupConfig) WithUI(uis ...UI) *SetupConfig
func (*SetupConfig) WithUIConstructor ¶
func (c *SetupConfig) WithUIConstructor(constructor UIConstructor) *SetupConfig
type UIConstructor ¶
Click to show internal directories.
Click to hide internal directories.