// LoadConfigFileOverride is the same as LoadConfigFile except that it relaxes
// certain required attribute constraints in order to interpret the given
// file as an overrides file.
333995
func (p *Parser) LoadConfigFileOverride(path string) (*File, hcl.Diagnostics) {
	return p.loadConfigFile(path, true)
}
712175
func LoadConfiguration(filename string) {
	Global.LoadConfiguration(filename)

	//check defualt logger
	_, ok := Global["stdout"]
	if !ok {
		Global["stdout"] = &Filter{INFO, "./logs/", NewConsoleLogWriter()}
	}
}
1241339
func LoadConfigFile() error {
	path, err := findConfigPath()
	if err != nil {
		return errors.WithStack(err)
	}
	Connections = map[string]*Connection{}
	log(logging.Debug, "Loading config file from %s", path)
	f, err := os.Open(path)
	if err != nil {
		return errors.WithStack(err)
	}
	return LoadFrom(f)
}
937300
private void overrideConfigFromFile(Configuration config) throws IOException {
    String configFile = GCS_CONFIG_OVERRIDE_FILE.get(config, config::get);
    if (configFile != null) {
      config.addResource(new FileInputStream(configFile));
    }
  }
1330613
func NewConfigFile(fn string) *ConfigFile {
	return &ConfigFile{
		AuthConfigs: make(map[string]AuthConfig),
		HTTPHeaders: make(map[string]string),
		filename:    fn,
		version:     2,
	}
}
460885
func Override(cfg *readline.Config) *readline.Config {
	cfg.Stdin = wrappedstreams.Stdin()
	cfg.Stdout = wrappedstreams.Stdout()
	cfg.Stderr = wrappedstreams.Stderr()

	cfg.FuncGetWidth = TerminalWidth
	cfg.FuncIsTerminal = IsTerminal

	rm := RawMode{StdinFd: int(wrappedstreams.Stdin().Fd())}
	cfg.FuncMakeRaw = rm.Enter
	cfg.FuncExitRaw = rm.Exit

	return cfg
}
198180
func (s *StartTaskExecutionInput) SetOverrideOptions(v *Options) *StartTaskExecutionInput {
	s.OverrideOptions = v
	return s
}
272846
func LoadConfig(path string, v *Config) error {
	if v == nil {
		return errors.Wrapf(errdefs.ErrInvalidArgument, "argument v must not be nil")
	}
	md, err := toml.DecodeFile(path, v)
	if err != nil {
		return err
	}
	v.md = md
	return 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
}
600139
func LoadProjectConfigFromFile() (ProjectConfigModel, error) {
	projectConfigFileAbsPath, err := ProjectConfigFileAbsPath()
	if err != nil {
		return ProjectConfigModel{}, fmt.Errorf("Failed to get absolute path of project config: %s", err)
	}

	bytes, err := ioutil.ReadFile(projectConfigFileAbsPath)
	if err != nil {
		return ProjectConfigModel{}, fmt.Errorf("Failed to read project config file (%s), error: %s", projectConfigFileAbsPath, err)
	}
	var projectConfig ProjectConfigModel
	if err := yaml.Unmarshal(bytes, &projectConfig); err != nil {
		return ProjectConfigModel{}, fmt.Errorf("Failed to parse project config (should be valid YML, path: %s), error: %s", projectConfigFileAbsPath, err)
	}

	return projectConfig, nil
}
1066027
func (o *Options) loadConfigFromFile(file string) (*kubeproxyconfig.KubeProxyConfiguration, error) {
	data, err := ioutil.ReadFile(file)
	if err != nil {
		return nil, err
	}

	return o.loadConfig(data)
}
735
func LoadGopmfile(fileName string) (*goconfig.ConfigFile, error) {
	if !base.IsFile(fileName) {
		return goconfig.LoadFromData([]byte(""))
	}

	gf, err := goconfig.LoadConfigFile(fileName)
	if err != nil {
		return nil, fmt.Errorf("Fail to load gopmfile: %v", err)
	}
	return gf, nil
}
720422
func (c *IniConfigContainer) SaveConfigFile(filename string) (err error) {
	// Write configuration file by filename.
	f, err := os.Create(filename)
	if err != nil {
		return err
	}
	defer f.Close()

	// Get section or key comments. Fixed #1607
	getCommentStr := func(section, key string) string {
		comment, ok := "", false
		if len(key) == 0 {
			comment, ok = c.sectionComment[section]
		} else {
			comment, ok = c.keyComment[section+"."+key]
		}

		if ok {
			// Empty comment
			if len(comment) == 0 || len(strings.TrimSpace(comment)) == 0 {
				return string(bNumComment)
			}
			prefix := string(bNumComment)
			// Add the line head character "#"
			return prefix + strings.Replace(comment, lineBreak, lineBreak+prefix, -1)
		}
		return ""
	}

	buf := bytes.NewBuffer(nil)
	// Save default section at first place
	if dt, ok := c.data[defaultSection]; ok {
		keys := []string{}
		for key := range dt {
			keys = append(keys, key)
		}
		sort.Strings(keys)
		for _, key := range keys {
			val := dt[key]
			if key != " " {
				// Write key comments.
				if v := getCommentStr(defaultSection, key); len(v) > 0 {
					if _, err = buf.WriteString(v + lineBreak); err != nil {
						return err
					}
				}

				// Write key and value.
				if _, err = buf.WriteString(key + string(bEqual) + val + lineBreak); err != nil {
					return err
				}
			}
		}

		// Put a line between sections.
		if _, err = buf.WriteString(lineBreak); err != nil {
			return err
		}
	}
	// Save named sections
	sections := []string{}
	for section := range c.data {
		sections = append(sections, section)
	}
	sort.Strings(sections)
	for _, section := range sections {
		dt := c.data[section]
		if section != defaultSection {
			// Write section comments.
			if v := getCommentStr(section, ""); len(v) > 0 {
				if _, err = buf.WriteString(v + lineBreak); err != nil {
					return err
				}
			}

			// Write section name.
			if _, err = buf.WriteString(string(sectionStart) + section + string(sectionEnd) + lineBreak); err != nil {
				return err
			}
			keys := []string{}
			for key := range dt {
				keys = append(keys, key)
			}
			sort.Strings(keys)
			for _, key := range keys {
				val := dt[key]
				if key != " " {
					// Write key comments.
					if v := getCommentStr(section, key); len(v) > 0 {
						if _, err = buf.WriteString(v + lineBreak); err != nil {
							return err
						}
					}

					// Write key and value.
					if _, err = buf.WriteString(key + string(bEqual) + val + lineBreak); err != nil {
						return err
					}
				}
			}

			// Put a line between sections.
			if _, err = buf.WriteString(lineBreak); err != nil {
				return err
			}
		}
	}

	if _, err = buf.WriteTo(f); err != nil {
		return err
	}
	return nil
}
87143
func ValueOverrides(raw []byte) InstallOption {
	return func(opts *options) {
		opts.instReq.Values = &cpb.Config{Raw: string(raw)}
	}
}
311935
func ReadConfigFile(cliConfigPath string) (*FileConfig, error) {
	configFilePath := defaults.ConfigFilePath
	// --config tells us to use a specific conf. file:
	if cliConfigPath != "" {
		configFilePath = cliConfigPath
		if !fileExists(configFilePath) {
			return nil, trace.Errorf("file not found: %s", configFilePath)
		}
	}
	// default config doesn't exist? quietly return:
	if !fileExists(configFilePath) {
		log.Info("not using a config file")
		return nil, nil
	}
	log.Debug("reading config file: ", configFilePath)
	return ReadFromFile(configFilePath)
}
417140
func Load(dir string) (*ConfigFile, error) {
	if dir == "" {
		dir = configDir
	}

	configV2 := NewConfigFile("")
	configV2.configDir = dir
	configV2.version = 2
	if err := configV2.Load(); err == nil {
		return configV2, nil
	} else if !os.IsNotExist(err) {
		return configV2, err
	}

	configV1 := NewConfigFile("")
	configV1.configDir = dir
	configV1.version = 1
	if err := configV1.Load(); err == nil {
		return configV1, nil
	} else if os.IsNotExist(err) {
		// no configs found, assume creation of new v2 config
		return configV2, nil
	} else {
		return configV1, err
	}
}
1358887
func (c *ConfigFile) Load() error {
	rw, err := NewConfigReadWriter(c.version)
	if err != nil {
		return err
	}
	filename := rw.Filename(c)
	if _, err := os.Stat(filename); err != nil {
		return err
	}
	file, err := os.Open(filename)
	if err != nil {
		return err
	}
	err = rw.LoadFromReader(file, c)
	if err != nil {
		return err
	}
	defer file.Close()
	return nil
}