Documentation
¶
Index ¶
Constants ¶
const ( ConfigFlagName = "config" LevelFlagName = "level" AppName = "ddctl" ConfigDir = "." + AppName BaseURLFlagName = "base-url" )
Variables ¶
This section is empty.
Functions ¶
func DefaultConfigFile ¶
func DefaultConfigFile() string
func InitViper ¶
InitViper function is responsible for reading the configuration file and environment variables, if they are set. The results are stored in viper. To retrieve a configuration, use the GetConfig function. The function accepts a cmd parameter which allows binding to command flags.
func InitViperInstance ¶
InitViperInstance function is responsible for reading the configuration file and environment variables, if they are set. The results are stored in viper. To retrieve a configuration, use the GetConfig function. The function accepts a cmd parameter which allows binding 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"`
Logging Logging `json:"logging" yaml:"logging"`
// BaseURL is the base URL in the Honeycomb UI for your environment.
// This is used to construct URLs to Honeycomb queries.
BaseURL string `json:"baseURL" yaml:"baseURL"`
// contains filtered or unexported fields
}
Config represents the persistent configuration data.
Currently, the format of the data on disk and in memory is identical. In the future, we may modify this to simplify changes to the disk format and to store in-memory values that should not be written to disk. Could that be achieved by embedding it in a different struct which contains values that shouldn't be serialized?
func GetConfig ¶
func GetConfig() *Config
GetConfig returns a configuration created from the viper configuration.
func UpdateViperConfig ¶
UpdateViperConfig update the viper configuration with the given expression. expression should be a value such as "agent.model=gpt-4o-mini" The input is a viper configuration because we leverage viper to handle setting most keys. However, in some special cases we use custom functions. This is why we return a Config object.
func (*Config) GetBaseURL ¶
func (*Config) GetConfigDir ¶
GetConfigDir returns the configuration directory
func (*Config) GetConfigFile ¶
GetConfigFile returns the configuration file
func (*Config) GetLogLevel ¶
type LogSink ¶
type LogSink struct {
// Set to true to write logs in JSON format
JSON bool `json:"json,omitempty" yaml:"json,omitempty"`
// Path is the path to write logs to. Use "stderr" to write to stderr.
// Use gcplogs:///projects/${PROJECT}/logs/${LOGNAME} to write to Google Cloud Logging
Path string `json:"path,omitempty" yaml:"path,omitempty"`
}