// GetConfig returns the config of the current Command execution
// context. It may load it with the provided function.
768718
func (c *Context) GetConfig() (*config.Config, error) {
	var err error
	if c.config == nil {
		if c.LoadConfig == nil {
			return nil, errors.New("nil LoadConfig function")
		}
		c.config, err = c.LoadConfig(c.ConfigRoot)
	}
	return c.config, err
}
821489
func GetConfig(c *caddy.Controller) *Config {
	ctx := c.Context().(*dnsContext)
	key := keyForConfig(c.ServerBlockIndex, c.ServerBlockKeyIndex)
	if cfg, ok := ctx.keysToConfigs[key]; ok {
		return cfg
	}
	// we should only get here during tests because directive
	// actions typically skip the server blocks where we make
	// the configs.
	ctx.saveConfig(key, &Config{ListenHosts: []string{""}})
	return GetConfig(c)
}
423633
func (s *server) GetConfig(c context.Context, req *empty.Empty) (*logdog.GetConfigResponse, error) {
	gcfg, err := endpoints.GetServices(c).Config(c)
	if err != nil {
		log.WithError(err).Errorf(c, "Failed to load configuration.")
		return nil, grpcutil.Internal
	}

	// Load our config service host from settings.
	settings, err := gaeconfig.FetchCachedSettings(c)
	if err != nil {
		log.WithError(err).Errorf(c, "Failed to load settings.")
		return nil, grpcutil.Internal
	}

	return &logdog.GetConfigResponse{
		ConfigServiceHost: settings.ConfigServiceHost,
		ConfigSet:         string(gcfg.ConfigSet),
		ServiceConfigPath: gcfg.ServiceConfigPath,

		// TODO(dnj): Deprecate this field once everything has switched over to
		// using host.
		ConfigServiceUrl: gcfg.ConfigServiceURL.String(),
	}, nil
}
107159
func (k *KubeadmCert) GetConfig(ic *kubeadmapi.InitConfiguration) (*certutil.Config, error) {
	for _, f := range k.configMutators {
		if err := f(ic, &k.config); err != nil {
			return nil, err
		}
	}

	return &k.config, nil
}
39015
func (c *RemoteClient) GetConfig(ctx context.Context) (*plan.Conf, error) {
	req := api.RequestV1{
		Method: api.GetConfig,
	}
	resp := api.ResponseV1{}
	if err := c.transp.Request(ctx, req, &resp); err != nil {
		return nil, err
	}
	return resp.GetConfig, nil
}
50675
func (a *API) GetUserConfig(user int, key string) (string, error) {
	url := a.BuildURL("/v2/user/%d/config/%s/", user, key)
	return a.getTextPlain(url, Params{})
}
376564
func (config *Config) GetString(key string, defaultValue string) (string, error) {
	value, err := config.Get(key, defaultValue)
	if err != nil {
		return defaultValue, err
	}
	if result, ok := value.(string); ok {
		return result, nil
	}
	return defaultValue, &ValueTypeError{key: key, value: value, message: "Value is not a string."}
}
166970
func (c *ConfigPolicy) Get(ns []string) *ConfigPolicyNode {

	n := c.config.Get(ns)
	if n == nil {
		return NewPolicyNode()
	}
	switch t := n.(type) {
	case ConfigPolicyNode:
		return &t
	default:
		return t.(*ConfigPolicyNode)
	}
}
1334013
func GetConfigFrom(dirs ...string) (*Config, error) {
	cfg := newConfig()
	for _, cd := range dirs {
		subcfg, err := GetConfigFromDir(cd)
		if err != nil {
			return nil, err
		}
		mergeConfigs(cfg, subcfg)
	}
	return cfg, nil
}
951804
func LoadConfig() (err error) {
	if !base.IsExist(ConfigFile) {
		os.MkdirAll(path.Dir(ConfigFile), os.ModePerm)
		if _, err = os.Create(ConfigFile); err != nil {
			return fmt.Errorf("fail to create config file: %v", err)
		}
	}

	Cfg, err = goconfig.LoadConfigFile(ConfigFile)
	if err != nil {
		return fmt.Errorf("fail to load config file: %v", err)
	}

	HttpProxy = Cfg.MustValue("settings", "HTTP_PROXY")
	return nil
}
65202
func (c *Cache) Config() Config {
	c.Lock()
	defer c.Unlock()
	return c.config
}
79846
func (c *client) GetConfiguration(ctx context.Context, throttlerName string) (map[string]*throttlerdatapb.Configuration, error) {
	response, err := c.gRPCClient.GetConfiguration(ctx, &throttlerdatapb.GetConfigurationRequest{
		ThrottlerName: throttlerName,
	})
	if err != nil {
		return nil, vterrors.FromGRPC(err)
	}
	return response.Configurations, nil
}
859545
func Config() (*DefaultConfig, error) {
	var err error
	config, err := LoadConfig("")
	if err != nil {
		return nil, err
	}

	return config, nil
}
734854
func GetConfigDir(ctx context.Context) string {
	cd, ok := ctx.Value(ctxKeyConfigDir).(string)
	if !ok {
		return ""
	}
	return cd
}
366813
func (s *Server) GetConfiguration(_ context.Context, request *throttlerdatapb.GetConfigurationRequest) (_ *throttlerdatapb.GetConfigurationResponse, err error) {
	defer servenv.HandlePanic("throttler", &err)

	configurations, err := s.manager.GetConfiguration(request.ThrottlerName)
	if err != nil {
		return nil, err
	}
	return &throttlerdatapb.GetConfigurationResponse{
		Configurations: configurations,
	}, nil
}
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
}
32745
func GetConfigService(c context.Context) configInterface.Interface {
	if iface, ok := c.Value(&configInterfaceKey).(configInterface.Interface); ok {
		return iface
	}
	return nil
}