INNER CODE UNIT · Go

getConfigPath

openrundev/openrun · cmd/openrun/main.go:86

func getConfigPath(cCtx *cli.Context) (clHomeRet, configFileRet string, clHomeEnvSet, homeDefaulted bool, errRet error) {
	configFile := cCtx.String(configFileFlagName)
	clHome := os.Getenv(types.OPENRUN_HOME)
	if configFile == "" {
		configFile = os.Getenv("CL_CONFIG_FILE")
		if configFile == "" && clHome != "" {
			configFile = path.Join(clHome, "openrun.toml")
		}
	}
	if clHome != "" {
		// Found OPENRUN_HOME
		return clHome, configFile, true, false, nil
	}
	if configFile != "" {
		// OPENRUN_HOME not set and config file is set, use config dir path as OPENRUN_HOME
		clHome = filepath.Dir(configFile)
		return clHome, configFile, false, false, nil
	}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…