// LoadConfiguration loads the provided configuration.
346464
func LoadConfiguration(config io.Reader) (*resourcequotaapi.Configuration, error) {
	// if no config is provided, return a default configuration
	if config == nil {
		externalConfig := &resourcequotav1beta1.Configuration{}
		scheme.Default(externalConfig)
		internalConfig := &resourcequotaapi.Configuration{}
		if err := scheme.Convert(externalConfig, internalConfig, nil); err != nil {
			return nil, err
		}
		return internalConfig, nil
	}
	// we have a config so parse it.
	data, err := ioutil.ReadAll(config)
	if err != nil {
		return nil, err
	}
	decoder := codecs.UniversalDecoder()
	decodedObj, err := runtime.Decode(decoder, data)
	if err != nil {
		return nil, err
	}
	resourceQuotaConfiguration, ok := decodedObj.(*resourcequotaapi.Configuration)
	if !ok {
		return nil, fmt.Errorf("unexpected type: %T", decodedObj)
	}
	return resourceQuotaConfiguration, nil
}
1317668
func (c *defConfigBackend) loadTemplateConfig() error {
	// get Environment Default Config Path
	templatePath := c.opts.templatePath
	if templatePath == "" {
		return nil
	}

	// if set, use it to load default config
	c.configViper.AddConfigPath(pathvar.Subst(templatePath))
	err := c.configViper.ReadInConfig() // Find and read the config file
	if err != nil {                     // Handle errors reading the config file
		return errors.Wrapf(err, "loading config from template failed: %s", templatePath)
	}
	return nil
}
564786
func loadConfig(path string) (config, error) {
	var ret config

	if path == "" {
		return ret, nil
	}

	file, err := os.Open(path)
	switch {
	case err == nil:
		defer file.Close()

		decoder := json.NewDecoder(file)
		if err = decoder.Decode(&ret); err != nil {
			return ret, errors.Annotate(err, "failed to decode file").Err()
		}
		return ret, nil

	case os.IsNotExist(err):
		// The file does not exist. We don't consider this an error, since the file
		// is optional.
		return ret, nil

	default:
		// An unexpected failure occurred.
		return ret, errors.Annotate(err, "failed to open file").Err()
	}
}
949470
func LoadConfig(configPath string) (types.Config, error) {
	config := types.Config{}

	bytes, err := ioutil.ReadFile(configPath)
	if err != nil {
		return config, err
	}

	if err := yaml.Unmarshal(bytes, &config); err != nil {
		return config, err
	}

	if config.LockTimeout == 0 {
		config.LockTimeout = defaultTTL
	}

	if config.GlobalTimeout == 0 {
		log.Fatal("[Config] Global timeout invaild, exit")
	}
	config.GlobalTimeout = config.GlobalTimeout * time.Second

	if config.Etcd.Prefix == "" {
		config.Etcd.Prefix = defaultPrefix
	}

	if config.Docker.APIVersion == "" {
		config.Docker.APIVersion = "1.32"
	}
	// 默认是 journald
	if config.Docker.Log.Type == "" {
		config.Docker.Log.Type = "journald"
	}
	if config.Scheduler.ShareBase == 0 {
		config.Scheduler.ShareBase = 100
	}
	if config.Scheduler.MaxShare == 0 {
		config.Scheduler.MaxShare = -1
	}

	return config, nil
}
825700
func (s *DescribeActivityTypeOutput) SetConfiguration(v *ActivityTypeConfiguration) *DescribeActivityTypeOutput {
	s.Configuration = v
	return s
}
82557
func loadConfig(configFile string) ([][]string, error) {
	f, err := os.Open(configFile)
	if err != nil {
		return nil, err
	}
	defer f.Close()

	var config [][]string
	if err := json.NewDecoder(f).Decode(&config); err != nil {
		return nil, err
	}
	return config, nil
}
712175
func LoadConfiguration(filename string) {
	Global.LoadConfiguration(filename)

	//check defualt logger
	_, ok := Global["stdout"]
	if !ok {
		Global["stdout"] = &Filter{INFO, "./logs/", NewConsoleLogWriter()}
	}
}
662041
func (s *UpdateBrokerRequest) SetConfiguration(v *ConfigurationId) *UpdateBrokerRequest {
	s.Configuration = v
	return s
}
366813
func (s *Server) GetConfiguration(_ context.Context, request *throttlerdatapb.GetConfigurationRequest) (_ *throttlerdatapb.GetConfigurationResponse, err error) {
	defer servenv.HandlePanic("throttler", &err)

	configurations, err := s.manager.GetConfiguration(request.ThrottlerName)
	if err != nil {
		return nil, err
	}
	return &throttlerdatapb.GetConfigurationResponse{
		Configurations: configurations,
	}, nil
}
1004895
func (s *DescribeWorkflowTypeOutput) SetConfiguration(v *WorkflowTypeConfiguration) *DescribeWorkflowTypeOutput {
	s.Configuration = v
	return s
}
178636
func (s *UpdateMatchmakingConfigurationOutput) SetConfiguration(v *MatchmakingConfiguration) *UpdateMatchmakingConfigurationOutput {
	s.Configuration = v
	return s
}
64768
func (f *Function) loadConfig(environment string) error {
	path := fmt.Sprintf("function.%s.json", environment)

	ok, err := f.tryConfig(path)
	if err != nil {
		return err
	}

	if ok {
		f.Log.WithField("config", path).Debug("loaded config")
		return nil
	}

	ok, err = f.tryConfig("function.json")
	if err != nil {
		return err
	}

	if ok {
		f.Log.WithField("config", "function.json").Debug("loaded config")
		return nil
	}

	return nil
}
39599
func (s *CreateCrawlerInput) SetConfiguration(v string) *CreateCrawlerInput {
	s.Configuration = &v
	return s
}
1152473
func LoadConfig(path string) (*Config, error) {
	settings := &Config{}

	c, err := config.ReadDefault(path)
	if err != nil {
		return nil, err
	}

	// Cloudinary settings
	var cURI *url.URL
	var uri string

	if uri, err = c.String("cloudinary", "uri"); err != nil {
		return nil, err
	}
	if cURI, err = url.Parse(uri); err != nil {
		return nil, errors.New(fmt.Sprint("cloudinary URI: ", err.Error()))
	}
	settings.CloudinaryURI = cURI

	// An optional remote prepend path
	if prepend, err := c.String("cloudinary", "prepend"); err == nil {
		settings.PrependPath = cloudinary.EnsureTrailingSlash(prepend)
	}
	settings.ProdTag, _ = c.String("global", "prodtag")

	// Keep files regexp? (optional)
	var pattern string
	pattern, _ = c.String("cloudinary", "keepfiles")
	if pattern != "" {
		settings.KeepFilesPattern = pattern
	}

	// mongodb section (optional)
	uri, _ = c.String("database", "uri")
	if uri != "" {
		var mURI *url.URL
		if mURI, err = url.Parse(uri); err != nil {
			return nil, errors.New(fmt.Sprint("mongoDB URI: ", err.Error()))
		}
		settings.MongoURI = mURI
	} else {
		fmt.Fprintf(os.Stderr, "Warning: database not set (upload sync disabled)\n")
	}

	// Looks for env variables, perform substitutions if needed
	if err := settings.handleEnvVars(); err != nil {
		return nil, err
	}
	return settings, nil
}
770558
func (m *Meta) loadConfig(rootDir string) (*configs.Config, tfdiags.Diagnostics) {
	var diags tfdiags.Diagnostics
	rootDir = m.normalizePath(rootDir)

	loader, err := m.initConfigLoader()
	if err != nil {
		diags = diags.Append(err)
		return nil, diags
	}

	config, hclDiags := loader.LoadConfig(rootDir)
	diags = diags.Append(hclDiags)
	return config, diags
}
1119773
func LoadConfig() (*Config, error) {
	task := "Load versioning-related configuration"
	spec := newConfigSpec()
	if err := loader.LoadConfig(spec); err != nil {
		return nil, errs.NewError(task, err)
	}
	return spec.local.parse()
}
483477
func (s *DescribeDomainOutput) SetConfiguration(v *DomainConfiguration) *DescribeDomainOutput {
	s.Configuration = v
	return s
}