config

package
v5.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Client *api.Client = &api.Client{}

Client used for the rest of the commands. The majority of the code relies on this client being available as a global variable. While this technically works, it's not great for testing via DI, injecting either a mocked or real implementation. To fascilitate this without a massive refactor, we promise now that Client always points to the same api.Client, and contents of it will get updated on client instantation. This allows dependency injection of "the thing that will become the client" into wherever it is needed before the thing becomes the client. Not too elegant, but it works and saves a lot of work. This are a lot of words to say: HACK.

View Source
var DefaultConfigFilepath = filepath.Join(api.DefaultConfigurationHomeDir, "lenses-cli.yml")

DefaultConfigFilepath the default config file path

Functions

func DecryptPassword

func DecryptPassword(cfg *api.ClientConfig)

DecryptPassword decrypts the password by provided client configuration

func EncryptPassword

func EncryptPassword(cfg *api.ClientConfig) error

EncryptPassword encrypts the password by provided client configuration

func NewGetConfigsCommand

func NewGetConfigsCommand() *cobra.Command

NewGetConfigsCommand creates the `configs` command

func NewGetModeCommand

func NewGetModeCommand() *cobra.Command

NewGetModeCommand creates the `mode` command

func SetupClient

func SetupClient() (err error)

SetupClient setups a new API client

func SetupConfigManager

func SetupConfigManager(set *pflag.FlagSet)

SetupConfigManager config manager

Types

type ConfigurationManager

type ConfigurationManager struct {
	Config *api.Config
	// flags below.
	CurrentContext string
	WaitForLenses  bool

	Filepath string
	// contains filtered or unexported fields
}

ConfigurationManager manager for config

var Manager *ConfigurationManager

Manager the config manager

func NewConfigurationManager

func NewConfigurationManager(set *pflag.FlagSet) *ConfigurationManager

NewConfigurationManager creates a configuration

func NewEmptyConfigManager

func NewEmptyConfigManager() *ConfigurationManager

NewEmptyConfigManager creates an empty configuration

func (*ConfigurationManager) Load

func (m *ConfigurationManager) Load() (bool, error)

Load loads the configuration

func (*ConfigurationManager) Save

func (m *ConfigurationManager) Save() error

Save saves the configuration

Jump to

Keyboard shortcuts

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