// Config validates and print the compose file.
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
}
1300102
func (s *SeesawSync) Config(arg int, config *config.Notification) error {
	return errors.New("unimplemented")
}
511425
func validateConfig(path string) error {
	dt, err := os.Open(filepath.Join(path, "config.json"))
	if err != nil {
		return err
	}

	m := types.PluginConfig{}
	err = json.NewDecoder(dt).Decode(&m)
	dt.Close()

	return err
}
952606
func (c *Config) AddConfig(section string, option string, value string) bool {
	if section == "" {
		section = DEFAULT_SECTION
	}

	if _, ok := c.data[section]; !ok {
		c.data[section] = make(map[string]string)
	}

	_, ok := c.data[section][option]
	c.data[section][option] = value

	return !ok
}
244668
func ValidateConfig(config *api.Config) []Error {
	allErrs := []Error{}
	if len(config.BuilderImage) == 0 {
		allErrs = append(allErrs, NewFieldRequired("builderImage"))
	}
	switch config.BuilderPullPolicy {
	case api.PullNever, api.PullAlways, api.PullIfNotPresent:
	default:
		allErrs = append(allErrs, NewFieldInvalidValue("builderPullPolicy"))
	}
	if config.DockerConfig == nil || len(config.DockerConfig.Endpoint) == 0 {
		allErrs = append(allErrs, NewFieldRequired("dockerConfig.endpoint"))
	}
	if config.DockerNetworkMode != "" && !validateDockerNetworkMode(config.DockerNetworkMode) {
		allErrs = append(allErrs, NewFieldInvalidValue("dockerNetworkMode"))
	}
	if config.Labels != nil {
		for k := range config.Labels {
			if len(k) == 0 {
				allErrs = append(allErrs, NewFieldInvalidValue("labels"))
			}
		}
	}
	if config.Tag != "" {
		if err := validateDockerReference(config.Tag); err != nil {
			allErrs = append(allErrs, NewFieldInvalidValueWithReason("tag", err.Error()))
		}
	}
	return allErrs
}
920344
func (t *Topic) Config() (map[string]string, error) {
	value, _, err := t.kz.conn.Get(t.configPath())
	if err != nil {
		return nil, err
	}

	return t.parseConfig(value)
}
357061
func (j JujuConfigProvider) Config() (ociCommon.ConfigurationProvider, error) {
	if err := j.Validate(); err != nil {
		return nil, err
	}
	return &j, nil
}
890627
func (c *Config) Config() *Config {
	// Guard against nil pointer dereference
	if c == nil {
		return NewConfig()
	}

	// Return a clone of the config so that this is immutable for the receiver
	c2 := *c
	return &c2
}
418697
func LoadConfig(path string) (*Config, error) {
	fi, err := os.Stat(path)
	if err != nil {
		return nil, err
	}

	if fi.IsDir() {
		return LoadConfigDir(path)
	}

	cleaned := filepath.Clean(path)
	config, err := ParseConfigFile(cleaned)
	if err != nil {
		return nil, fmt.Errorf("Error loading %s: %s", cleaned, err)
	}

	config.Files = append(config.Files, cleaned)
	return config, nil
}
1332082
func validateConfig(f string) error {
	viper.SetConfigFile(f)
	err := viper.ReadInConfig()
	if err != nil {
		switch err.(type) {
		case viper.ConfigParseError:
			return err
		default:
			return errors.New("unable to locate config file, use \"centrifugo genconfig -c " + f + "\" command to generate one")
		}
	}
	c := nodeConfig()
	return c.Validate()
}
702999
func initConfig() error {
	re, _ := regexp.Compile(pat)

	r, ok := os.LookupEnv("PCP_DIR")
	if !ok {
		r = "/"
	}
	rootPath = r

	c, ok := os.LookupEnv("PCP_CONF")
	if !ok {
		c = filepath.Join(rootPath, "etc", "pcp.conf")
	}
	confPath = c

	f, err := os.Open(confPath)
	if err != nil {
		return err
	}

	// if we reach at this point, it means we have a valid config
	// that can be read, so we can make the map non-nil
	config = make(map[string]string)
	scanner := bufio.NewScanner(f)
	for scanner.Scan() {
		t := scanner.Text()
		if re.MatchString(t) {
			matches := re.FindStringSubmatch(t)
			config[matches[1]] = matches[2]
		}
	}

	return nil
}
250879
func parseConfig(path string, config interface{}, prefix string, found map[string]string) error {
	file, err := os.Open(path)
	if err != nil {
		return err
	}
	defer file.Close()

	parseConfigContents(file, config, prefix, found)

	return nil
}
103780
func (r *FSRepo) Config() (*config.Config, error) {
	// It is not necessary to hold the package lock since the repo is in an
	// opened state. The package lock is _not_ meant to ensure that the repo is
	// thread-safe. The package lock is only meant to guard against removal and
	// coordinate the lockfile. However, we provide thread-safety to keep
	// things simple.
	packageLock.Lock()
	defer packageLock.Unlock()

	if r.closed {
		return nil, errors.New("cannot access config, repo not open")
	}
	return r.config, nil
}
633818
func (s *Service) Config(w http.ResponseWriter, r *http.Request) {
	ctx := r.Context()

	config, err := s.Store.Config(ctx).Get(ctx)
	if err != nil {
		Error(w, http.StatusBadRequest, err.Error(), s.Logger)
		return
	}

	if config == nil {
		Error(w, http.StatusBadRequest, "Configuration object was nil", s.Logger)
		return
	}
	res := newConfigResponse(*config)

	encodeJSON(w, http.StatusOK, res, s.Logger)
}
1130619
func (g *Generation) Config() map[string]settings.ItemChanges {
	changes := make(map[string]settings.ItemChanges, len(g.doc.Config))
	for appName, appCfg := range g.doc.Config {
		appChanges := make(settings.ItemChanges, len(appCfg))
		for i, ch := range appCfg {
			appChanges[i] = ch.coreChange()
		}
		sort.Sort(appChanges)
		changes[appName] = appChanges
	}
	return changes
}
26440
func writeConfig(ctx *cli.Context, data []byte) {
	dir := filepath.Dir(configPath())

	// try to create the netctl config directory but ignore "already exists" errors.
	// only the user should be able to read the contents of this directory
	if err := os.Mkdir(dir, 0700); err != nil && !os.IsExist(err) {
		errExit(ctx, exitIO, err.Error(), false)
	}

	// only the user should be able to read the config file
	if err := ioutil.WriteFile(configPath(), data, 0600); err != nil {
		errExit(ctx, exitIO, err.Error(), false)
	}
}
1126001
func (m *MockGeneration) Config() map[string]settings.ItemChanges {
	ret := m.ctrl.Call(m, "Config")
	ret0, _ := ret[0].(map[string]settings.ItemChanges)
	return ret0
}