// GetConfigPolicy returns a ConfigPolicy for testing
764104
func (f *Mock) GetConfigPolicy() (plugin.ConfigPolicy, error) {
	p := plugin.NewConfigPolicy()

	err := p.AddNewStringRule([]string{"intel", "mock", "test%>"}, "name", false, plugin.SetDefaultString("bob"))
	if err != nil {
		return *p, err
	}

	err = p.AddNewStringRule([]string{"intel", "mock", "/foo=㊽"}, "password", true)

	return *p, err
}
1081887
func (registry *pluginRegistry) GetPlugin(ID string) Plugin {
	registry.guard.RLock()
	plugin, exists := registry.plugins[ID]
	registry.guard.RUnlock()

	if exists {
		return plugin
	}
	return nil
}
1220734
func (c *configCommand) getConfig(client configCommandAPI, ctx *cmd.Context) error {
	if len(c.keys) == 1 && certBytes != nil {
		ctx.Stdout.Write(certBytes)
		return nil
	}
	attrs, err := client.ModelGetWithMetadata()
	if err != nil {
		return err
	}

	for attrName := range attrs {
		// We don't want model attributes included, these are available
		// via show-model.
		if c.isModelAttribute(attrName) {
			delete(attrs, attrName)
		}
	}

	if len(c.keys) == 1 {
		key := c.keys[0]
		if value, found := attrs[key]; found {
			if c.out.Name() == "tabular" {
				// The user has not specified that they want
				// YAML or JSON formatting, so we print out
				// the value unadorned.
				return c.out.WriteFormatter(
					ctx,
					cmd.FormatSmart,
					value.Value,
				)
			}
			attrs = config.ConfigValues{
				key: config.ConfigValue{
					Source: value.Source,
					Value:  value.Value,
				},
			}
		} else {
			return errors.Errorf("key %q not found in %q model.", key, attrs["name"])
		}
	} else {
		// In tabular format, don't print "cloudinit-userdata" it can be very long,
		// instead give instructions on how to print specifically.
		if value, ok := attrs[config.CloudInitUserDataKey]; ok && c.out.Name() == "tabular" {
			if value.Value.(string) != "" {
				value.Value = "<value set, see juju model-config cloudinit-userdata>"
				attrs["cloudinit-userdata"] = value
			}
		}
	}

	return c.out.Write(ctx, attrs)
}
1299433
func (p *Plugin) getPMConfig() (path string, err error) {
	var pmConfig Config
	found, err := p.Cfg.LoadValue(&pmConfig)
	if err != nil {
		return path, errors.Errorf("failed to read process manager config file: %v", err)
	}
	if found {
		return pmConfig.TemplatePath, nil
	}
	return path, nil
}
778990
func (r *FSRepo) GetConfigKey(key string) (interface{}, error) {
	packageLock.Lock()
	defer packageLock.Unlock()

	if r.closed {
		return nil, errors.New("repo is closed")
	}

	filename, err := config.Filename(r.path)
	if err != nil {
		return nil, err
	}
	var cfg map[string]interface{}
	if err := serialize.ReadConfigFile(filename, &cfg); err != nil {
		return nil, err
	}
	return common.MapGetKV(cfg, key)
}
1280704
func getConfig(t *testing.T) *cfg.Config {
	c := cfg.ResetTestRoot(t.Name())

	// and we use random ports to run in parallel
	tm, rpc, grpc := makeAddrs()
	c.P2P.ListenAddress = tm
	c.RPC.ListenAddress = rpc
	c.RPC.GRPCListenAddress = grpc
	return c
}
14365
func GetConfigurationDir() (string, error) {
	gaugeHome := os.Getenv(GaugeHome)
	if gaugeHome != "" {
		return filepath.Join(gaugeHome, config), nil
	}

	var configDir string

	if isWindows() {
		appDataPath := os.Getenv(appData)
		if appDataPath == "" {
			return "", fmt.Errorf("Cannot locate gauge shared file. Could not find App Data directory.")
		}
		configDir = filepath.Join(appDataPath, ProductName, config)
	} else {
		home := os.Getenv("HOME")
		configDir = filepath.Join(home, DotGauge, config)
	}

	if configDir != "" {
		return configDir, nil
	}

	return "", fmt.Errorf("Can't find configuration files")
}
1022460
func (conn *Connection) GetConfigOption(section string,
	option string, auth Auth) (string, error) {
	url, err := buildUrl("_node/_local/_config", section, option)
	if err != nil {
		return "", err
	}
	resp, err := conn.request("GET", url, nil, nil, auth)
	var val interface{}
	parseBody(resp, &val)
	if num, ok := val.(int); ok == true {
		return strconv.Itoa(num), nil
	}
	if str, ok := val.(string); ok == true {
		return str, nil
	}
	return "", nil
}
298855
func (c *ConfigPolicy) getDefaults() Config {
	config := NewConfig()
	for _, v := range c.stringRules {
		for key, val := range v.Rules {
			if val.HasDefault {
				config[key] = val.Default
			}
		}
	}
	for _, v := range c.boolRules {
		for key, val := range v.Rules {
			if val.HasDefault {
				config[key] = val.Default
			}
		}
	}
	for _, v := range c.floatRules {
		for key, val := range v.Rules {
			if val.HasDefault {
				config[key] = val.Default
			}
		}
	}
	for _, v := range c.integerRules {
		for key, val := range v.Rules {
			if val.HasDefault {
				config[key] = val.Default
			}
		}
	}

	return config
}
1360404
func ImplicitMetaAnyPolicy(policyName string) *StandardConfigPolicy {
	return &StandardConfigPolicy{
		key:   policyName,
		value: makeImplicitMetaPolicy(policyName, cb.ImplicitMetaPolicy_ANY),
	}
}
775965
func (p *Provider) GetApplicationConfig(cid string) (channelconfig.Application, bool) {
	return p.PeerSupport.GetApplicationConfig(cid)
}
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
}
566577
func GetConfig(L *lua.LState) *Config {
	const registryKey = "github.com/layeh/gopher-luar"

	registry := L.Get(lua.RegistryIndex).(*lua.LTable)
	lConfig, ok := registry.RawGetString(registryKey).(*lua.LUserData)
	if !ok {
		lConfig = L.NewUserData()
		lConfig.Value = newConfig()
		registry.RawSetString(registryKey, lConfig)
	}
	return lConfig.Value.(*Config)
}
528331
func getConfig(envVars ...string) (value string) {
	value = ""
	for _, v := range envVars {
		value = os.Getenv(v)
		if value != "" {
			break
		}
	}
	return
}
813621
func getConfig(c context.Context) config.ConfigurationServer {
	return c.Value(&cfgKey).(config.ConfigurationServer)
}
85807
func (c *ConfigParser) Get(section, option string) (val string, err error) {
	if _, ok := c.sections[section]; !ok {
		return val, newNoSectionError(section)
	}
	sec := c.sections[section]

	if _, ok := sec.options[option]; !ok {
		return val, newNoOptionError(section, option)
	}

	return sec.options[option], err
}
23342
func (r RProcessor) GetConfigPolicy() (plugin.ConfigPolicy, error) {
	policy := plugin.NewConfigPolicy()

	policy.AddNewBoolRule([]string{"random"},
		"testbool",
		false)

	return *policy, nil
}