// getConfig is the run action to return one or all configuration values.
487519
func (c *configCommand) getConfig(client applicationAPI, ctx *cmd.Context) error {
	results, err := client.Get(c.branchName, c.applicationName)
	if err != nil {
		return err
	}
	if len(c.keys) == 1 {
		logger.Infof("format %v is ignored", c.out.Name())
		key := c.keys[0]
		info, found := results.CharmConfig[key].(map[string]interface{})
		if !found && len(results.ApplicationConfig) > 0 {
			info, found = results.ApplicationConfig[key].(map[string]interface{})
		}
		if !found {
			return errors.Errorf("key %q not found in %q application config or charm settings.", key, c.applicationName)
		}
		v, ok := info["value"]
		if !ok || v == nil {
			// Note that unlike the output with a non-nil and non-empty value below, this
			// output should never have a newline.
			return nil
		}
		// TODO (anastasiamac 2018-08-29) We want to have a new line after here (fmt.Fprintln).
		// However, it will break all existing scripts and should be done as part of Juju 3.x work.
		_, err := fmt.Fprint(ctx.Stdout, v)
		return errors.Trace(err)
	}

	resultsMap := map[string]interface{}{
		"application": results.Application,
		"charm":       results.Charm,
		"settings":    results.CharmConfig,
	}
	if len(results.ApplicationConfig) > 0 {
		resultsMap["application-config"] = results.ApplicationConfig
	}

	err = c.out.Write(ctx, resultsMap)

	if featureflag.Enabled(feature.Generations) && err == nil {
		var gen string
		gen, err = c.ActiveBranch()
		if err == nil {
			_, err = ctx.Stdout.Write([]byte(fmt.Sprintf("\nchanges will be targeted to generation: %s\n", gen)))
		}
	}
	return errors.Trace(err)
}
65202
func (c *Cache) Config() Config {
	c.Lock()
	defer c.Unlock()
	return c.config
}
353110
func (c *FakeConfigMaps) Get(name string, options v1.GetOptions) (result *corev1.ConfigMap, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewGetAction(configmapsResource, c.ns, name), &corev1.ConfigMap{})

	if obj == nil {
		return nil, err
	}
	return obj.(*corev1.ConfigMap), err
}
1360294
func NewGetConfig(ctx *middleware.Context, handler GetConfigHandler) *GetConfig {
	return &GetConfig{Context: ctx, Handler: handler}
}
408318
func getConfigurationAction(client *gocd.Client, c *cli.Context) (r interface{}, resp *gocd.APIResponse, err error) {
	return client.Configuration.Get(context.Background())
}
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
}
289960
func GetConf(filename string, configuration interface{}) (err error) {

	configValue := reflect.ValueOf(configuration)
	if typ := configValue.Type(); typ.Kind() != reflect.Ptr || typ.Elem().Kind() != reflect.Struct {
		return fmt.Errorf("configuration should be a pointer to a struct type")
	}

	err = getFromYAML(filename, configuration)
	if err == nil {
		getFromEnvVariables(configuration)
	}

	return
}
502929
func GetConfig(tx ReadTx, id string) *api.Config {
	c := tx.get(tableConfig, id)
	if c == nil {
		return nil
	}
	return c.(*api.Config)
}
212208
func (adm *AdminClient) GetConfig() ([]byte, error) {
	// Execute GET on /minio/admin/v1/config to get config of a setup.
	resp, err := adm.executeMethod("GET",
		requestData{relPath: "/v1/config"})
	defer closeResponse(resp)
	if err != nil {
		return nil, err
	}

	if resp.StatusCode != http.StatusOK {
		return nil, httpRespToErrorResponse(resp)
	}
	defer closeResponse(resp)

	return DecryptData(adm.secretAccessKey, resp.Body)
}
1185715
func (c *Client) GetConfig(subject string) (Config, error) {
	return c.getConfigSubject(subject)
}
51316
func (c *Config) getConfig() *oauth2.Config {
	return &oauth2.Config{
		ClientID:     c.Client.ID,
		ClientSecret: c.Client.Secret,
		RedirectURL:  c.Client.RedirectURL,
		Endpoint: oauth2.Endpoint{
			TokenURL: fmt.Sprintf("%s/users/token", c.Server),
			AuthURL:  fmt.Sprintf("%s/users/authorize", c.Server),
		},
	}
}
382869
func (c *ResourceConfig) Get(k string) (interface{}, bool) {
	// We aim to get a value from the configuration. If it is computed,
	// then we return the pure raw value.
	source := c.Config
	if c.IsComputed(k) {
		source = c.Raw
	}

	return c.get(k, source)
}
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
}
877571
func (s *ConnectCA) ConfigurationGet(
	args *structs.DCSpecificRequest,
	reply *structs.CAConfiguration) error {
	// Exit early if Connect hasn't been enabled.
	if !s.srv.config.ConnectEnabled {
		return ErrConnectNotEnabled
	}

	if done, err := s.srv.forward("ConnectCA.ConfigurationGet", args, args, reply); done {
		return err
	}

	// This action requires operator read access.
	rule, err := s.srv.ResolveToken(args.Token)
	if err != nil {
		return err
	}
	if rule != nil && !rule.OperatorRead() {
		return acl.ErrPermissionDenied
	}

	state := s.srv.fsm.State()
	_, config, err := state.CAConfig()
	if err != nil {
		return err
	}
	*reply = *config

	return nil
}
408208
func (c *Cluster) GetConfigs(options apitypes.ConfigListOptions) ([]types.Config, error) {
	c.mu.RLock()
	defer c.mu.RUnlock()

	state := c.currentNodeState()
	if !state.IsActiveManager() {
		return nil, c.errNoManager(state)
	}

	filters, err := newListConfigsFilters(options.Filters)
	if err != nil {
		return nil, err
	}
	ctx, cancel := c.getRequestContext()
	defer cancel()

	r, err := state.controlClient.ListConfigs(ctx,
		&swarmapi.ListConfigsRequest{Filters: filters},
		grpc.MaxCallRecvMsgSize(defaultRecvSizeForListResponse))
	if err != nil {
		return nil, err
	}

	configs := []types.Config{}

	for _, config := range r.Configs {
		configs = append(configs, convert.ConfigFromGRPC(config))
	}

	return configs, 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)
}
1069171
func (c *Config) get(key string) string {
	var (
		section string
		option  string
	)

	keys := strings.Split(strings.ToLower(key), "::")
	if len(keys) >= 2 {
		section = keys[0]
		option = keys[1]
	} else {
		section = DEFAULT_SECTION
		option = keys[0]
	}

	if value, ok := c.data[section][option]; ok {
		return value
	}

	return ""
}