// FromReader loads configuration from in.
// configType can be "json" or "yaml".
332615
func FromReader(in io.Reader, configType string, opts ...Option) core.ConfigProvider {
	return func() ([]core.ConfigBackend, error) {
		return initFromReader(in, configType, opts...)
	}
}
890324
func FromRaw(configBytes []byte, configType string, opts ...Option) core.ConfigProvider {
	return func() ([]core.ConfigBackend, error) {
		buf := bytes.NewBuffer(configBytes)
		return initFromReader(buf, configType, opts...)
	}
}
383894
func WithReader(a adaptor.Adaptor) OptionFunc {
	return func(n *Node) error {
		r, err := a.Reader()
		n.reader = r
		return err
	}
}
937376
func FromReader(rd io.Reader) (digest.Digest, error) {
	return digest.Canonical.FromReader(rd)
}
961168
func FromDir(dir string) (*Store, error) {
	dir = strings.TrimRight(dir, "/")
	files, err := ioutil.ReadDir(dir)
	if err != nil {
		return nil, err
	}

	s := New()
	var wg sync.WaitGroup
	count := struct {
		sync.Mutex
		n int
	}{}

	errCh := make(chan error, len(files))
	for _, stat := range files {
		if strings.HasSuffix(stat.Name(), entityFileSuffix) {
			wg.Add(1)
			go func(path string, group string) {
				defer wg.Done()
				f, err := os.Open(path)
				if err != nil {
					errCh <- fmt.Errorf("error opening %v: %v\n", path, err)
					return
				}
				defer f.Close()

				err = AddFromReader(f, s, group)
				if err != nil {
					errCh <- fmt.Errorf("error reading from %v: %v\n", path, err)
					return
				}
				count.Lock()
				count.n++
				count.Unlock()
			}(fmt.Sprintf("%s/%s", dir, stat.Name()), strings.TrimSuffix(stat.Name(), entityFileSuffix))
		}
	}
	wg.Wait()
	close(errCh)

	for e := range errCh {
		if err == nil {
			err = e
		}
	}
	if err != nil {
		return nil, err
	}

	if count.n == 0 {
		return nil, errors.New("no entity files found")
	}
	return s, nil
}
860782
func (f *File) FromArg(read bool) error {
	// (length - 1)
	arg := os.Args[len(os.Args)-1:][0]

	// get extension
	ext := path.Ext(arg)
	if len(ext) > 1 {
		ext = ext[1:] // remove dot
	}

	// when json/yaml/toml file isn't found on last arg
	// it searches for a ".json", ".yaml", ".yml" or ".toml" string in all args
	if ext != "json" && ext != "yaml" && ext != "yml" && ext != "toml" {
		// loop through args
		for _, a := range os.Args {
			// get extension
			ext := path.Ext(a)

			// check for valid extensions
			if ext == ".json" || ext == ".yaml" || ext == ".yml" || ext == ".toml" {
				f.Mode = ext[1:] // remove dot
				ext = f.Mode
				arg = a
				break
			}
		}
	} else {
		f.Mode = ext
	}

	// check if extension is json, yaml or toml
	// then get it's absolute path
	if ext == "json" || ext == "yaml" || ext == "yml" || ext == "toml" {
		f.FilePath = arg

		// so we can test without reading a file
		if read {
			if !utils.Exists(f.FilePath) {
				return errors.New("Error: I Can't find the config file at [" + f.FilePath + "]")
			}
		}
	} else {
		return errors.New("Error: You must specify a json, yaml or toml file")
	}

	return nil
}
412770
func NewReader(r io.Reader, limiter Limiter) io.Reader {
	return &reader{r, limiter}
}
906665
func NewConfigurationParserFromReader(settings io.Reader) *ConfigurationParser {
	is := InstallationSettings{}
	b, _ := ioutil.ReadAll(settings)
	if err := json.Unmarshal(b, &is); err != nil {
		lo.G.Error("Unmarshal installation settings error", err)
	}
	
    is.SetPGDumpUtilVersions()
	return &ConfigurationParser{
		InstallationSettings: is,
	}
}
985664
func FromJSON(data *[]byte, current string, namespace *[]string) error {

	var m map[string]interface{}
	err := json.Unmarshal(*data, &m)

	if err != nil {
		return err
	}

	return FromMap(m, current, namespace)
}
219740
func (m *Module) ReadConfig(i interface{}) error {
	m.configDefs = append(m.configDefs, reflect.TypeOf(i))
	return json.Unmarshal(m.Byte, i)
}
687342
func newReader(ctx context.Context, d *dispatcher, r io.ReadCloser) *reader {
	return &reader{
		ctx: ctx,
		d:   d,
		r:   r,
	}
}
622434
func LoadReader(reader io.Reader) (tree *Tree, err error) {
	inputBytes, err := ioutil.ReadAll(reader)
	if err != nil {
		return
	}
	tree, err = LoadBytes(inputBytes)
	return
}
769710
func (s *SearchService) From(from int) *SearchService {
	s.searchSource = s.searchSource.From(from)
	return s
}
873387
func requestReader(req *http.Request) (io.ReadCloser, error) {
	switch req.Header.Get("content-encoding") {
	case "gzip":
		return gzip.NewReader(req.Body)
	case "deflate":
		return flate.NewReader(req.Body), nil
	}

	// If no encoding, use raw body
	return req.Body, nil
}
1184863
func FromReader(r io.Reader) (*Model, error) {
	model := new(Model)
	d := json.NewDecoder(r)
	err := d.Decode(model)
	if err != nil {
		return nil, err
	}
	model.updateSuffixArr()
	return model, nil
}
783303
func ParseReader(reader io.Reader) (*Section, error) {
	parser := NewParser(reader)
	err := parser.Parse()
	if err != nil {
		return nil, err
	}

	return parser.GetSettings(), nil
}
494529
func FromConfigString(config, configType string) (Provider, error) {
	v := newViper()
	m, err := readConfig(metadecoders.FormatFromString(configType), []byte(config))
	if err != nil {
		return nil, err
	}

	v.MergeConfigMap(m)

	return v, nil
}