// Returns the list of configuration files, if they exist in order of hierarchy.
// The files are read in order and each new file can/will override previous
// file settings.
Returns the list of configuration files, if they exist in order of hierarchy.
The files are read in order and each new file can/will override previous
file settings.
// Returns the list of configuration files if they exist in order of hierarchy . // The files are read in order and each new file can / will override previous // file settings .
func systemConfigs() ([]string, error) {
	configs := []string{}
	path := os.Getenv("CONTAINERS_CONF")
	if path != "" {
		if _, err := os.Stat(path); err != nil {
			return nil, errors.Wrap(err, "failed to stat of %s from CONTAINERS_CONF environment variable")
		}
		return append(configs, path), nil
	}
	if _, err := os.Stat(DefaultContainersConfig); err == nil {
		configs = append(configs, DefaultContainersConfig)
	}
	if _, err := os.Stat(OverrideContainersConfig); err == nil {
		configs = append(configs, OverrideContainersConfig)
	}
	if unshare.IsRootless() {
		path, err := rootlessConfigPath()
		if err != nil {
			return nil, err
		}
		if _, err := os.Stat(path); err == nil {
			configs = append(configs, path)
		}
	}
	return configs, nil
}
func systemConfigs ( ) ( [ ] string , error ) { configs := [ ] string { } path := os . Getenv ( " " ) if path != " " { if _ , err := os . Stat ( path ) ; err != nil { return nil , errors . Wrap ( err , " " ) } return append ( configs , path ) , nil } if _ , err := os . Stat ( DefaultContainersConfig ) ; err == nil { configs = append ( configs , DefaultContainersConfig ) } if _ , err := os . Stat ( OverrideContainersConfig ) ; err == nil { configs = append ( configs , OverrideContainersConfig ) } if unshare . IsRootless ( ) { path , err := rootlessConfigPath ( ) if err != nil { return nil , err } if _ , err := os . Stat ( path ) ; err == nil { configs = append ( configs , path ) } } return configs , nil }
Returns the list of configuration files, if they exist in order of hierarchy.
Returns the list of configuration files if they exist in order of hierarchy .