// GetConfigClient implements Provider.
175179
func (p *RemoteProvider) GetConfigClient(c context.Context, a backend.Authority) config.Interface {
	p.cacheLock.RLock()
	impl, ok := p.cache[a]
	p.cacheLock.RUnlock()
	if ok {
		return impl
	}

	p.cacheLock.Lock()
	defer p.cacheLock.Unlock()

	if impl, ok := p.cache[a]; ok {
		return impl
	}

	// Create our remote implementation.
	impl = remote.New(p.Host, p.Insecure, func(c context.Context) (*http.Client, error) {
		var opts []auth.RPCOption
		if a == backend.AsUser && p.testUserDelegationToken != "" {
			opts = append(opts, auth.WithDelegationToken(p.testUserDelegationToken))
		}
		t, err := auth.GetRPCTransport(c, rpcAuthorityKind(a), opts...)
		if err != nil {
			return nil, err
		}
		return &http.Client{Transport: t}, nil
	})
	if p.cache == nil {
		p.cache = make(map[backend.Authority]config.Interface, 3)
	}
	p.cache[a] = impl

	return impl
}
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
}
1239639
func (f *Function) GetConfigCurrent() (*lambda.GetFunctionOutput, error) {
	return f.GetConfigQualifier(f.Alias)
}
1185715
func (c *Client) GetConfig(subject string) (Config, error) {
	return c.getConfigSubject(subject)
}
746220
func (s *Service) ServiceConfigPath() (cfglib.Set, string) {
	return cfglib.ServiceSet(s.serviceID), svcconfig.ServiceConfigPath
}
242426
func (*configSupport) GetChannelConfig(channel string) cc.Config {
	chains.RLock()
	defer chains.RUnlock()
	chain := chains.list[channel]
	if chain == nil {
		peerLogger.Errorf("[channel %s] channel not associated with this peer", channel)
		return nil
	}
	return chain.cs.bundleSource.ConfigtxValidator()
}
1289472
func (m *testRPC) GetRPCClient(contextID string) (*RPCHdl, error) {
	if mock := m.currentMocks(nil); mock != nil && mock.GetRPCClientMock != nil {
		return mock.GetRPCClientMock(contextID)
	}
	return nil, nil
}
296593
func (s *serverConfig) GetCacheConfig() CacheConfig {
	if globalIsDiskCacheEnabled {
		return CacheConfig{
			Drives:  globalCacheDrives,
			Exclude: globalCacheExcludes,
			Expiry:  globalCacheExpiry,
			MaxUse:  globalCacheMaxUse,
		}
	}
	if s == nil {
		return CacheConfig{}
	}
	return s.Cache
}
643787
func NewCliClient(c *cli.Context) (cl *gocd.Client, err error) {
	var profile string

	if profile = c.String("profile"); profile == "" {
		profile = "default"
	}

	cfg := &gocd.Configuration{}
	err = gocd.LoadConfigByName(profile, cfg)

	setStringFromContext(&cfg.Server, "server", c)

	if cfg.Server == "" {
		if err == nil {
			// If we didn't have any errors, and our server is empty, use the local.
			cfg.Server = "https://127.0.0.1:8154/go/"
		} else {
			return
		}
		return
	}

	setStringFromContext(&cfg.Username, "username", c)
	setStringFromContext(&cfg.Password, "password", c)

	cfg.SkipSslCheck = cfg.SkipSslCheck || c.Bool("skip_ssl_check")

	return cfg.Client(), nil
}
32745
func GetConfigService(c context.Context) configInterface.Interface {
	if iface, ok := c.Value(&configInterfaceKey).(configInterface.Interface); ok {
		return iface
	}
	return nil
}
505231
func (e *loginProvision) gpgClient(m libkb.MetaContext) (gpgInterface, error) {
	if e.arg.DeviceType == libkb.DeviceTypeMobile {
		return nil, libkb.GPGUnavailableError{}
	}
	if e.gpgCli != nil {
		return e.gpgCli, nil
	}

	gpg := m.G().GetGpgClient()
	ok, err := gpg.CanExec()
	if err != nil {
		return nil, err
	}
	if !ok {
		return nil, libkb.GPGUnavailableError{}
	}
	e.gpgCli = gpg
	return e.gpgCli, nil
}
1362584
func getCloudProvider(cloudProvider cloudprovider.Interface) (*gcecloud.Cloud, error) {
	var err error
	for numRetries := 0; numRetries < maxRetries; numRetries++ {
		gceCloudProvider, ok := cloudProvider.(*gcecloud.Cloud)
		if !ok || gceCloudProvider == nil {
			// Retry on error. See issue #11321
			klog.Errorf("Failed to get GCE Cloud Provider. plugin.host.GetCloudProvider returned %v instead", cloudProvider)
			time.Sleep(errorSleepDuration)
			continue
		}

		return gceCloudProvider, nil
	}

	return nil, fmt.Errorf("Failed to get GCE GCECloudProvider with error %v", err)
}
805172
func getConf(cfg string) (c Configuration) {
	// load the local configuration file
	fd, err := ioutil.ReadFile(cfg)
	if err != nil {
		log.Fatal(err)
	}
	err = yaml.Unmarshal(fd, &c)
	if err != nil {
		log.Fatalf("error: %v", err)
	}
	// iterate over notifications in targets and unbase64 the values
	for i, run := range c.Runs {
		for j, rcpt := range run.Notifications.Email.Recipients {
			if len(rcpt) < 5 || rcpt[0:4] != "b64:" {
				continue
			}
			data, err := base64.StdEncoding.DecodeString(rcpt[4:])
			if err != nil {
				log.Fatalf("error while decoding b64 recipient: %v", err)
			}
			c.Runs[i].Notifications.Email.Recipients[j] = fmt.Sprintf("%s", bytes.TrimRight(data, "\n"))
		}
	}
	if os.Getenv("TLSOBS_RUNNER_SMTP_HOST") != "" {
		c.Smtp.Host = os.Getenv("TLSOBS_RUNNER_SMTP_HOST")
	}
	if os.Getenv("TLSOBS_RUNNER_SMTP_PORT") != "" {
		var err error
		c.Smtp.Port, err = strconv.Atoi(os.Getenv("TLSOBS_RUNNER_SMTP_PORT"))
		if err != nil {
			log.Printf("[error] failed to read smtp port from env variable: %v", err)
		}
	}
	if os.Getenv("TLSOBS_RUNNER_SMTP_FROM") != "" {
		c.Smtp.From = os.Getenv("TLSOBS_RUNNER_SMTP_FROM")
	}
	if os.Getenv("TLSOBS_RUNNER_SMTP_AUTH_USER") != "" {
		c.Smtp.Auth.User = os.Getenv("TLSOBS_RUNNER_SMTP_AUTH_USER")
	}
	if os.Getenv("TLSOBS_RUNNER_SMTP_AUTH_PASS") != "" {
		c.Smtp.Auth.Pass = os.Getenv("TLSOBS_RUNNER_SMTP_AUTH_PASS")
	}
	if os.Getenv("TLSOBS_RUNNER_SLACK_USERNAME") != "" {
		c.Slack.Username = os.Getenv("TLSOBS_RUNNER_USERNAME")
	}
	if os.Getenv("TLSOBS_RUNNER_SLACK_ICONEMOJI") != "" {
		c.Slack.IconEmoji = os.Getenv("TLSOBS_RUNNER_SLACK_ICONEMOJI")
	}
	if os.Getenv("TLSOBS_RUNNER_SLACK_WEBHOOK") != "" {
		c.Slack.Webhook = os.Getenv("TLSOBS_RUNNER_SLACK_WEBHOOK")
	}
	return c
}
639861
func (cli *Client) ConfigGet(target string) (*pb.ConfigReply, error) {
	req := &pb.ConfigRequest{Target: target}
	ctx, cancel := context.WithTimeout(context.Background(), cli.timeout)
	defer cancel()
	rpl, err := cli.configClient.Get(ctx, req)
	return rpl, err
}
1285431
func GetConfiguration(name ConfigName) (interface{}, error) {
	var u C.uint32_t
	if err := newError(C.yr_get_configuration(
		C.YR_CONFIG_NAME(name), unsafe.Pointer(&u)),
	); err != nil {
		return nil, err
	}
	return int(u), nil
}
1321132
func (t *TLSServer) GetConfigForClient(info *tls.ClientHelloInfo) (*tls.Config, error) {
	var clusterName string
	var err error
	if info.ServerName != "" {
		clusterName, err = auth.DecodeClusterName(info.ServerName)
		if err != nil {
			if !trace.IsNotFound(err) {
				log.Debugf("Ignoring unsupported cluster name name %q.", info.ServerName)
				clusterName = ""
			}
		}
	}
	pool, err := auth.ClientCertPool(t.AccessPoint, clusterName)
	if err != nil {
		log.Errorf("failed to retrieve client pool: %v", trace.DebugReport(err))
		// this falls back to the default config
		return nil, nil
	}
	tlsCopy := t.TLS.Clone()
	tlsCopy.ClientCAs = pool
	return tlsCopy, nil
}
270888
func (c ConfigClient) WaitForClient(ctx context.Context, __arg WaitForClientArg) (res bool, err error) {
	err = c.Cli.Call(ctx, "keybase.1.config.waitForClient", []interface{}{__arg}, &res)
	return
}