in commands/property.go [427:483]
func loadProperties() error {
var err error
SetDefaultProperties()
Properties.PropsFile, err = GetPropertiesFilePath()
if err != nil {
return nil
//whisk.Debug(whisk.DbgError, "GetPropertiesFilePath() failed: %s\n", err)
//errStr := fmt.Sprintf("Unable to load the properties file: %s", err)
//werr := whisk.MakeWskError(errors.New(errStr), whisk.EXIT_CODE_ERR_GENERAL, whisk.DISPLAY_MSG, whisk.NO_DISPLAY_USAGE)
//return werr
}
props, err := ReadProps(Properties.PropsFile)
if err != nil {
whisk.Debug(whisk.DbgError, "readProps(%s) failed: %s\n", Properties.PropsFile, err)
errStr := wski18n.T("Unable to read the properties file '{{.filename}}': {{.err}}",
map[string]interface{}{"filename": Properties.PropsFile, "err": err})
werr := whisk.MakeWskError(errors.New(errStr), whisk.EXIT_CODE_ERR_GENERAL, whisk.DISPLAY_MSG, whisk.NO_DISPLAY_USAGE)
return werr
}
if cert, hasProp := props["CERT"]; hasProp {
Properties.Cert = cert
}
if key, hasProp := props["KEY"]; hasProp {
Properties.Key = key
}
if authToken, hasProp := props["AUTH"]; hasProp {
Properties.Auth = authToken
}
if authToken := os.Getenv("WHISK_AUTH"); len(authToken) > 0 {
Properties.Auth = authToken
}
if apiVersion, hasProp := props["APIVERSION"]; hasProp {
Properties.APIVersion = apiVersion
}
if apiVersion := os.Getenv("WHISK_APIVERSION"); len(apiVersion) > 0 {
Properties.APIVersion = apiVersion
}
if apiHost, hasProp := props["APIHOST"]; hasProp {
Properties.APIHost = strings.TrimRight(apiHost, "/")
}
if apiHost := os.Getenv("WHISK_APIHOST"); len(apiHost) > 0 {
Properties.APIHost = apiHost
}
return nil
}