MCPcopy Create free account
hub / github.com/apache/openwhisk-cli / GetPropertiesFilePath

Function GetPropertiesFilePath

commands/property.go:397–425  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

395}
396
397func GetPropertiesFilePath() (propsFilePath string, werr error) {
398 var envExists bool
399
400 // WSK_CONFIG_FILE environment variable overrides the default properties file path
401 // NOTE: If this variable is set to an empty string or non-existent/unreadable file
402 // - any existing $HOME/.wskprops is ignored
403 // - a default configuration is used
404 if propsFilePath, envExists = os.LookupEnv("WSK_CONFIG_FILE"); envExists {
405 whisk.Debug(whisk.DbgInfo, "Using properties file '%s' from WSK_CONFIG_FILE environment variable\n", propsFilePath)
406 return propsFilePath, nil
407 } else {
408 var err error
409
410 propsFilePath, err = homedir.Expand(Properties.PropsFile)
411
412 if err != nil {
413 whisk.Debug(whisk.DbgError, "homedir.Expand(%s) failed: %s\n", Properties.PropsFile, err)
414 errStr := fmt.Sprintf(
415 wski18n.T("Unable to locate properties file '{{.filename}}': {{.err}}",
416 map[string]interface{}{"filename": Properties.PropsFile, "err": err}))
417 werr = whisk.MakeWskError(errors.New(errStr), whisk.EXIT_CODE_ERR_GENERAL, whisk.DISPLAY_MSG, whisk.NO_DISPLAY_USAGE)
418 return propsFilePath, werr
419 }
420
421 whisk.Debug(whisk.DbgInfo, "Using properties file home dir '%s'\n", propsFilePath)
422 }
423
424 return propsFilePath, nil
425}
426
427func loadProperties() error {
428 var err error

Callers 1

loadPropertiesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected