in commands/property.go [397:425]
func GetPropertiesFilePath() (propsFilePath string, werr error) {
var envExists bool
// WSK_CONFIG_FILE environment variable overrides the default properties file path
// NOTE: If this variable is set to an empty string or non-existent/unreadable file
// - any existing $HOME/.wskprops is ignored
// - a default configuration is used
if propsFilePath, envExists = os.LookupEnv("WSK_CONFIG_FILE"); envExists {
whisk.Debug(whisk.DbgInfo, "Using properties file '%s' from WSK_CONFIG_FILE environment variable\n", propsFilePath)
return propsFilePath, nil
} else {
var err error
propsFilePath, err = homedir.Expand(Properties.PropsFile)
if err != nil {
whisk.Debug(whisk.DbgError, "homedir.Expand(%s) failed: %s\n", Properties.PropsFile, err)
errStr := fmt.Sprintf(
wski18n.T("Unable to locate 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 propsFilePath, werr
}
whisk.Debug(whisk.DbgInfo, "Using properties file home dir '%s'\n", propsFilePath)
}
return propsFilePath, nil
}