config

package
v0.0.0-...-5be5665 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetAndBindFlag

func SetAndBindFlag(client *ConfigClient, name string, value interface{}, description string) error

SetAndBindFlag sets and binds a flag to a command and viper.

Note these are some unsupported types: map[string]interface{}, map[string][]string, time.Time

Types

type Client

type Client[C schemas.BaseConfiguration] interface {
	GetConfig() C
	SetAndBindFlag(string, interface{}, string) error
}

Client interface

type ClientGetter

type ClientGetter struct{}

ClientGetter is an struct for getting a BB config client.

func (*ClientGetter) GetClient

func (clientGetter *ClientGetter) GetClient(command *cobra.Command, loggingClient *bbLog.Client, viperInstance *viper.Viper) (*ConfigClient, error)

GetClient returns a new config client.

type ConfigClient

type ConfigClient struct {
	// contains filtered or unexported fields
}

ConfigClient is composed of functions to interact with configuration.

func NewClient

func NewClient(
	getConfig GetConfigFunc,
	setAndBindFlag SetAndBindFlagFunc,
	loggingClient *bbLog.Client,
	command *cobra.Command,
	viperInstance *viper.Viper,
) (*ConfigClient, error)

NewClient returns a new config client with the provided configuration

func (*ConfigClient) GetConfig

func (client *ConfigClient) GetConfig() *schemas.GlobalConfiguration

GetConfig returns the global configuration.

func (*ConfigClient) SetAndBindFlag

func (client *ConfigClient) SetAndBindFlag(name string, value interface{}, description string) error

SetAndBindFlag sets and binds a flag to a command and viper.

type GetConfigFunc

type GetConfigFunc func(*ConfigClient) *schemas.GlobalConfiguration

GetConfigFunc type

type SetAndBindFlagFunc

type SetAndBindFlagFunc func(*ConfigClient, string, interface{}, string) error

SetAndBindFlagFunc type

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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