// DecodeConfig creates a services Config from a given Hugo configuration.
493758
func DecodeConfig(cfg config.Provider) (c Config, err error) {
	m := cfg.GetStringMap(servicesConfigKey)

	err = mapstructure.WeakDecode(m, &c)

	// Keep backwards compatibility.
	if c.GoogleAnalytics.ID == "" {
		// Try the global config
		c.GoogleAnalytics.ID = cfg.GetString(googleAnalyticsKey)
	}
	if c.Disqus.Shortname == "" {
		c.Disqus.Shortname = cfg.GetString(disqusShortnameKey)
	}

	if c.RSS.Limit == 0 {
		c.RSS.Limit = cfg.GetInt(rssLimitKey)
	}

	return
}
433866
func Decode(input interface{}, output interface{}) error {
	config := &DecoderConfig{
		Metadata: nil,
		Result:   output,
	}

	decoder, err := NewDecoder(config)
	if err != nil {
		return err
	}

	return decoder.Decode(input)
}
804600
func (p *providerImpl) ParseConfig() (*OIDCConfiguration, error) {
	prov, err := p.provider()
	if err != nil {
		return nil, err
	}
	return ParseConfig(prov)
}
488656
func (kv *KvSource) LoadConfig(config interface{}) error {
	pairs, err := kv.ListValuedPairWithPrefix(kv.Prefix)
	if err != nil {
		return err
	}

	mapStruct, err := generateMapstructure(convertPairs(pairs), kv.Prefix)
	if err != nil {
		return err
	}

	configDecoder := &mapstructure.DecoderConfig{
		Metadata:         nil,
		Result:           config,
		WeaklyTypedInput: true,
		DecodeHook:       decodeHook,
	}
	decoder, err := mapstructure.NewDecoder(configDecoder)
	if err != nil {
		return err
	}
	if err := decoder.Decode(mapStruct); err != nil {
		return err
	}
	return nil
}
645514
func ParseConfig(filename string) (Database, error) {
	f, err := os.Open(filename)
	if err != nil {
		return Database{}, err
	}
	return parseConfig(f)
}
807555
func DecodeConfig(r io.Reader) (config image.Config, err error) {
	header := make([]byte, maxWebpHeaderSize)
	n, err := r.Read(header)
	if err != nil && err != io.EOF {
		return
	}
	header, err = header[:n], nil
	width, height, _, err := GetInfo(header)
	if err != nil {
		return
	}
	config.Width = width
	config.Height = height
	config.ColorModel = color.RGBAModel
	return
}
558861
func (p *Project) Config() (string, error) {
	cfg := ExportedConfig{
		Version:  "2.0",
		Services: p.ServiceConfigs.All(),
		Volumes:  p.VolumeConfigs,
		Networks: p.NetworkConfigs,
	}

	bytes, err := yaml.Marshal(cfg)
	return string(bytes), err
}
700663
func defaultDecoderConfig(output interface{}, opts ...DecoderConfigOption) *mapstructure.DecoderConfig {
	c := &mapstructure.DecoderConfig{
		Metadata:         nil,
		Result:           output,
		WeaklyTypedInput: true,
		DecodeHook: mapstructure.ComposeDecodeHookFunc(
			mapstructure.StringToTimeDurationHookFunc(),
			mapstructure.StringToSliceHookFunc(","),
		),
	}
	for _, opt := range opts {
		opt(c)
	}
	return c
}
361182
func Config(ctx context.Context, provider content.Provider, image ocispec.Descriptor, platform platforms.MatchComparer) (ocispec.Descriptor, error) {
	manifest, err := Manifest(ctx, provider, image, platform)
	if err != nil {
		return ocispec.Descriptor{}, err
	}
	return manifest.Config, err
}
1230684
func readConfig(fileName string) (*Config, error) {
	file, err := os.Open(fileName)
	if nil != err {
		return nil, err
	}
	defer file.Close()

	in, err := ioutil.ReadAll(file)
	if nil != err {
		return nil, err
	}

	config := new(Config)
	err = xml.Unmarshal(in, config)
	if nil != err {
		return nil, err
	}

	return config, err
}
157178
func ParseConfig(raw []byte, id string) (*Config, error) {
	var result Config
	if err := util.Unmarshal(raw, &result); err != nil {
		return nil, err
	}
	return &result, result.validateAndInjectDefaults(id)
}
115539
func ParseConfig(reader io.Reader) (config Config, err error) {
	// TODO: make a better decoder to avoid having a buffer here and decoding
	// twice.
	buf := &bytes.Buffer{}
	var common Common
	err = json.NewDecoder(io.TeeReader(reader, buf)).Decode(&common)
	if err != nil {
		return nil, err
	}
	v, err := parseVersion(common.Version)
	if err != nil {
		return nil, err
	}
	switch v {
	case Version1:
		var v1 V1
		err = json.NewDecoder(buf).Decode(&v1)
		if err != nil {
			return nil, err
		}
		return &v1, (&v1).EnsureInit()
	default:
		return nil, ErrInvalidVersion{}
	}
}
886055
func (f *Function) GetConfig() (*lambda.GetFunctionOutput, error) {
	f.Log.Debug("fetching config")
	return f.Service.GetFunction(&lambda.GetFunctionInput{
		FunctionName: &f.FunctionName,
	})
}
839641
func (p *Provider) DecodeConfiguration(content string) (*config.Configuration, error) {
	configuration := &config.Configuration{
		HTTP: &config.HTTPConfiguration{
			Routers:     make(map[string]*config.Router),
			Middlewares: make(map[string]*config.Middleware),
			Services:    make(map[string]*config.Service),
		},
		TCP: &config.TCPConfiguration{
			Routers:  make(map[string]*config.TCPRouter),
			Services: make(map[string]*config.TCPService),
		},
		TLS:        make([]*tls.Configuration, 0),
		TLSStores:  make(map[string]tls.Store),
		TLSOptions: make(map[string]tls.TLS),
	}
	if _, err := toml.Decode(content, configuration); err != nil {
		return nil, err
	}
	return configuration, nil
}
1004904
func (c *agentConf) ReadConfig(tag string) error {
	t, err := names.ParseTag(tag)
	if err != nil {
		return errors.Trace(err)
	}
	c.mu.Lock()
	defer c.mu.Unlock()
	conf, err := agent.ReadConfig(agent.ConfigPath(c.dataDir, t))
	if err != nil {
		return errors.Trace(err)
	}
	c._config = conf
	return nil
}
93029
func (c *Configurator) LoadConfig(serviceName string, data interface{}) (yarpc.Config, error) {
	var cfg yarpcConfig
	if err := config.DecodeInto(&cfg, data); err != nil {
		return yarpc.Config{}, err
	}
	return c.load(serviceName, &cfg)
}
846154
func LoadConfig(configFile io.Reader) (string, error) {
	var kubeconfigFile string
	if configFile != nil {
		// we have a config so parse it.
		data, err := ioutil.ReadAll(configFile)
		if err != nil {
			return "", err
		}
		decoder := codecs.UniversalDecoder()
		decodedObj, err := runtime.Decode(decoder, data)
		if err != nil {
			return "", err
		}
		config, ok := decodedObj.(*webhookadmission.WebhookAdmission)
		if !ok {
			return "", fmt.Errorf("unexpected type: %T", decodedObj)
		}

		if !path.IsAbs(config.KubeConfigFile) {
			return "", field.Invalid(field.NewPath("kubeConfigFile"), config.KubeConfigFile, "must be an absolute file path")
		}

		kubeconfigFile = config.KubeConfigFile
	}
	return kubeconfigFile, nil
}