in commands/property.go [485:540]
func parseConfigFlags(cmd *cobra.Command, args []string) error {
if cert := Flags.Global.Cert; len(cert) > 0 {
Properties.Cert = cert
if Client != nil {
Client.Config.Cert = cert
}
}
if key := Flags.Global.Key; len(key) > 0 {
Properties.Key = key
if Client != nil {
Client.Config.Key = key
}
}
if auth := Flags.Global.Auth; len(auth) > 0 {
Properties.Auth = auth
if Client != nil {
Client.Config.AuthToken = auth
}
}
if apiVersion := Flags.Global.Apiversion; len(apiVersion) > 0 {
Properties.APIVersion = apiVersion
if Client != nil {
Client.Config.Version = apiVersion
}
}
if apiHost := Flags.Global.Apihost; len(apiHost) > 0 {
Properties.APIHost = apiHost
if Client != nil {
Client.Config.Host = apiHost
baseURL, err := whisk.GetURLBase(apiHost, DefaultOpenWhiskApiPath)
if err != nil {
whisk.Debug(whisk.DbgError, "whisk.GetURLBase(%s, %s) failed: %s\n", apiHost, DefaultOpenWhiskApiPath, err)
errStr := wski18n.T("Invalid host address '{{.host}}': {{.err}}",
map[string]interface{}{"host": Properties.APIHost, "err": err})
werr := whisk.MakeWskError(errors.New(errStr), whisk.EXIT_CODE_ERR_GENERAL, whisk.DISPLAY_MSG, whisk.NO_DISPLAY_USAGE)
return werr
}
Client.Config.BaseURL = baseURL
}
}
if Flags.Global.Debug {
whisk.SetDebug(true)
}
if Flags.Global.Verbose {
whisk.SetVerbose(true)
}
return nil
}