config

package
v0.0.0-...-6b3d2bb Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	ConfigFlagName = "config"
	LevelFlagName  = "level"
	ConfigDir      = ".hccli"
)

Variables

This section is empty.

Functions

func DefaultConfigFile

func DefaultConfigFile() string

func InitViper

func InitViper(cmd *cobra.Command) error

InitViper reads in config file and ENV variables if set. The results are stored inside viper. Call GetConfig to get a configuration. The cmd is passed in so we can bind to command flags

Types

type Config

type Config struct {
	APIVersion string `json:"apiVersion" yaml:"apiVersion" yamltags:"required"`
	Kind       string `json:"kind" yaml:"kind" yamltags:"required"`

	// AIEndpoint is the endpoint of the model that turns natural language into queries
	AIEndpoint string `json:"aiEndpoint" yaml:"aiEndpoint"`

	// HoneycombAPIKeyFile contains the URI of the APIKey for HoneyComb
	HoneycombAPIKeyFile string `json:"honeycombAPIKeyFile" yaml:"honeycombAPIKeyFile"`

	Logging Logging `json:"logging" yaml:"logging"`
}

Config is the configuration data that gets persisted for kubedr.

N.B. Right now the ondisk format and the in memory format are the same. We might want ot change that in the future to make it easier to change the on disk format and also to store derived values in memory that shouldn't be persisted to disk.

func GetConfig

func GetConfig() *Config

GetConfig returns the configuration instantiated from the viper configuration.

func (*Config) GetConfigDir

func (c *Config) GetConfigDir() string

GetConfigDir returns the configuration directory

func (*Config) GetLogLevel

func (c *Config) GetLogLevel() string

func (*Config) IsValid

func (c *Config) IsValid() []string

IsValid returns any errors with the configuration. The return is a list of configuration problems

func (*Config) Write

func (c *Config) Write(cfgFile string) error

Write writes the configuration to the specified file.

type Logging

type Logging struct {
	Level string `json:"level" yaml:"level"`
}

Jump to

Keyboard shortcuts

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