// ReadConfig reads configuration files on the system from default locations or
// at the path passed to configPath. The first configuration file found will be
// read. The configuration file paths are checked in the following order:
//
// defaultConfig "/usr/share/defaults/diva/config.toml"
// systemConfig  "/etc/diva/config.toml"
// userConfig    "$HOME/.config/diva/config.toml"
ReadConfig reads configuration files on the system from default locations or
at the path passed to configPath. The first configuration file found will be
read. The configuration file paths are checked in the following order.

defaultConfig "/usr/share/defaults/diva/config.toml"
systemConfig  "/etc/diva/config.toml"
userConfig    "$HOME/.config/diva/config.toml"
// ReadConfig reads configuration files on the system from default locations or // at the path passed to configPath . The first configuration file found will be // read . The configuration file paths are checked in the following order : // // defaultConfig " / usr / share / defaults / diva / config . toml " // systemConfig " / etc / diva / config . toml " // userConfig " $HOME / . config / diva / config . toml "
func ReadConfig(configPath string) (*Config, error) {
	var err error
	c := defaultConf()
	userConfPath := filepath.Join(os.Getenv("HOME"), userConfig)
	order := []string{configPath, userConfPath, systemConfig, defaultConfig}
	for _, path := range order {
		if path == "" {
			continue
		}
		_, err = toml.DecodeFile(path, &c)
		if os.IsNotExist(err) {
			continue
		}
		return &c, err
	}
	return &c, nil
}
func ReadConfig ( configPath string ) ( * Config , error ) { var err error c := defaultConf ( ) userConfPath := filepath . Join ( os . Getenv ( " " ) , userConfig ) order := [ ] string { configPath , userConfPath , systemConfig , defaultConfig } for _ , path := range order { if path == " " { continue } _ , err = toml . DecodeFile ( path , & c ) if os . IsNotExist ( err ) { continue } return & c , err } return & c , nil }
ReadConfig reads configuration files on the system from default locations or
at the path passed to configPath.
ReadConfig reads configuration files on the system from default locations or at the path passed to configPath .
// return the first configuration file found, check in the following order // configPath may be empty // if the file isn't found, try the next one // file found, return result of decode // no configuration file, return compiled defaults