Documentation
¶
Overview ¶
Package config provides utilities for configuration keys in the configuration files.
Index ¶
- Variables
- func ConvertToValidProfileName(input string) string
- func GetConfig(o Option) string
- func LoadAppConfig()
- func PersistConfig() error
- func SetConfigByOption(user string, o Option, value string)
- func SuggestionsFor(typedName string) []string
- type AppConfig
- type CliOption
- type Option
- type Property
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ConfigFileOverrides contains the CLI flags that override the values in the config file. // // It is a map of flag key to usage. ConfigFileOverrides = map[string]string{ "cb-api-id": "the API ID to be used for authorization", "cb-api-key": "the API Key to be used for authorization", "org-key": "the Org key of the organization in CBC", "saas-url": "the Base URL of the CBC backend", } )
Functions ¶
func ConvertToValidProfileName ¶
ConvertToValidProfileName will convert input to valid profile name.
func LoadAppConfig ¶
func LoadAppConfig()
LoadAppConfig will initialize application config from viper.
func SetConfigByOption ¶
SetConfigByOption will set the config by a given option-value to the active profile.
func SuggestionsFor ¶
SuggestionsFor provides suggestions for the typedName.
Types ¶
type AppConfig ¶
type AppConfig struct {
ActiveUserProfile string
AccessToKeyring bool
Properties map[string]*Property
CliOpt *CliOption
}
AppConfig is the config of the cli app.
type CliOption ¶
type CliOption struct {
ConfigFile string `mapstructure:"config"`
UserProfile string `mapstructure:"user-profile"`
PlainMode bool `mapstructure:"plain-mode"`
}
CliOption contains all the cli flag options.
type Option ¶
type Option int
Option is the behind number of a config, used for enum.
const ( // ActiveUserProfile is the current active profile. ActiveUserProfile Option = iota // SaasURL is the cloud SaaS url. SaasURL // OrgKey is the org_id. OrgKey // DefaultBuildStep in the default build step. DefaultBuildStep // CBApiID is the carbon black api id; // put under cntOfOptions since the following two options are for auth. CBApiID // CBApiKey is the carbon black api key. CBApiKey )
func (Option) StringWithPrefix ¶
StringWithPrefix will return the option string with a prefix.
Click to show internal directories.
Click to hide internal directories.