// GetSettings retrieves settings from the ArgoCDConfigMap and secret.
484015
func (mgr *SettingsManager) GetSettings() (*ArgoCDSettings, error) {
	err := mgr.ensureSynced(false)
	if err != nil {
		return nil, err
	}
	argoCDCM, err := mgr.configmaps.ConfigMaps(mgr.namespace).Get(common.ArgoCDConfigMapName)
	if err != nil {
		return nil, err
	}
	argoCDSecret, err := mgr.secrets.Secrets(mgr.namespace).Get(common.ArgoCDSecretName)
	if err != nil {
		return nil, err
	}
	var settings ArgoCDSettings
	var errs []error
	if err := updateSettingsFromConfigMap(&settings, argoCDCM); err != nil {
		errs = append(errs, err)
	}
	if err := updateSettingsFromSecret(&settings, argoCDSecret); err != nil {
		errs = append(errs, err)
	}
	if len(errs) > 0 {
		return &settings, errs[0]
	}
	return &settings, nil
}
797777
func (c *Configs) GetConfig(configName configName) (*ConfigSettings, error) {
	// Order byConfig according to configNames ordering function.
	out := &ConfigSettings{}
	for _, pair := range c.getSortedConfigPairs() {
		ok := true
		for i, confKey := range configName {
			if pair.key[i].isBound() && pair.key[i].compare(confKey) != 0 {
				ok = false
				break
			}
		}
		if ok {
			var err error
			if out, err = out.union(pair.value); err != nil {
				return nil, err
			}
		}
	}
	return out, nil
}
618688
func (s *Option) SetOptionSettings(v []*OptionSetting) *Option {
	s.OptionSettings = v
	return s
}
653618
func createSettings(db Database, collection, key string, values map[string]interface{}) (*Settings, error) {
	s := newSettings(db, collection, key)
	s.core = copyMap(values, nil)
	ops := []txn.Op{createSettingsOp(collection, key, values)}
	err := s.db.RunTransaction(ops)
	if err == txn.ErrAborted {
		return nil, errSettingsExist
	}
	if err != nil {
		return nil, fmt.Errorf("cannot create settings: %v", err)
	}
	return s, nil
}
462669
func (m MemSettings) ReadSettings(key string) (map[string]interface{}, error) {
	settings, ok := m.Settings[key]
	if !ok {
		return nil, errors.NotFoundf("settings with key %q", key)
	}
	return settings, nil
}
676218
func (m MemSettings) ListSettings(keyPrefix string) (map[string]map[string]interface{}, error) {
	result := make(map[string]map[string]interface{})
	for key, settings := range m.Settings {
		if !strings.HasPrefix(key, keyPrefix) {
			continue
		}
		result[key] = settings
	}
	return result, nil
}
954645
func applicationSetSettingsStrings(
	application Application, gen string, settings map[string]string,
) error {
	ch, _, err := application.Charm()
	if err != nil {
		return errors.Trace(err)
	}
	// Parse config in a compatible way (see function comment).
	changes, err := parseSettingsCompatible(ch.Config(), settings)
	if err != nil {
		return errors.Trace(err)
	}
	return application.UpdateCharmConfig(gen, changes)
}
728193
func (s *Server) Get(ctx context.Context, q *SettingsQuery) (*Settings, error) {
	argoCDSettings, err := s.mgr.GetSettings()
	if err != nil {
		return nil, err
	}

	overrides := make(map[string]*v1alpha1.ResourceOverride)
	for k := range argoCDSettings.ResourceOverrides {
		val := argoCDSettings.ResourceOverrides[k]
		overrides[k] = &val
	}
	set := Settings{
		URL:               argoCDSettings.URL,
		AppLabelKey:       argoCDSettings.GetAppInstanceLabelKey(),
		ResourceOverrides: overrides,
	}
	if argoCDSettings.DexConfig != "" {
		var cfg DexConfig
		err = yaml.Unmarshal([]byte(argoCDSettings.DexConfig), &cfg)
		if err == nil {
			set.DexConfig = &cfg
		}
	}
	if oidcConfig := argoCDSettings.OIDCConfig(); oidcConfig != nil {
		set.OIDCConfig = &OIDCConfig{
			Name:        oidcConfig.Name,
			Issuer:      oidcConfig.Issuer,
			ClientID:    oidcConfig.ClientID,
			CLIClientID: oidcConfig.CLIClientID,
		}
	}
	return &set, nil
}
1183619
func (configMgr *ConfigurationManager) GetConfigurationsByKey(key string) interface{} {
	configMgr.configMapMux.Lock()
	sourceName, ok := configMgr.ConfigurationMap[key]
	configMgr.configMapMux.Unlock()
	if !ok {
		return nil
	}

	return configMgr.configValueBySource(key, sourceName)
}
1206808
func (s *UpdateJobTemplateInput) SetSettings(v *JobTemplateSettings) *UpdateJobTemplateInput {
	s.Settings = v
	return s
}
187959
func (s *TranscriptionJob) SetSettings(v *Settings) *TranscriptionJob {
	s.Settings = v
	return s
}
1298843
func GetGaugeConfiguration() (properties.Properties, error) {
	configDir, err := GetConfigurationDir()
	if err != nil {
		return nil, err
	}
	propertiesFile := filepath.Join(configDir, GaugePropertiesFile)
	config, err := properties.Load(propertiesFile)
	if err != nil {
		return nil, err
	}
	return config, nil
}
478956
func (s *StartTranscriptionJobInput) SetSettings(v *Settings) *StartTranscriptionJobInput {
	s.Settings = v
	return s
}
413400
func (s *ListAccountSettingsOutput) SetSettings(v []*Setting) *ListAccountSettingsOutput {
	s.Settings = v
	return s
}
1237680
func ReadSettings(configFolder string) (public, protected map[string]interface{}, _ error) {
	cf, err := settingsPath(configFolder)
	if err != nil {
		return nil, nil, fmt.Errorf("canot locate settings file: %v", err)
	}
	hs, err := parseHandlerSettingsFile(cf)
	if err != nil {
		return nil, nil, fmt.Errorf("error parsing settings file: %v", err)
	}

	public = hs.PublicSettings
	if err := unmarshalProtectedSettings(configFolder, hs, &protected); err != nil {
		return nil, nil, fmt.Errorf("failed to parse protected settings: %v", err)
	}
	return public, protected, nil
}
1073909
func Get(c context.Context) (*DatabaseSettings, error) {
	databaseSettings := &DatabaseSettings{}
	switch err := settings.Get(c, settingsKey, databaseSettings); err {
	case nil:
		return databaseSettings, nil
	case settings.ErrNoSettings:
		return New(c), nil
	default:
		return nil, err
	}
}
125746
func (u *Unit) ConfigSettings() (charm.Settings, error) {
	var results params.ConfigSettingsResults
	args := params.Entities{
		Entities: []params.Entity{{Tag: u.tag.String()}},
	}
	err := u.st.facade.FacadeCall("ConfigSettings", args, &results)
	if err != nil {
		return nil, err
	}
	if len(results.Results) != 1 {
		return nil, errors.Errorf("expected 1 result, got %d", len(results.Results))
	}
	result := results.Results[0]
	if result.Error != nil {
		return nil, result.Error
	}
	return charm.Settings(result.Settings), nil
}