func getConfig()

in main.go [185:201]


func getConfig(configs map[string]agentConfig, annotations map[string]string) (agentConfig, error) {
	ac := agentConfig{}
	if annotations == nil {
		return ac, errors.New("no annotations present")
	}
	// TODO: Do we want to support multiple comma-separated agents?
	agent, ok := annotations[apmAnnotation]
	if !ok {
		return ac, fmt.Errorf("missing annotation `%s`", apmAnnotation)
	}
	// TODO: validate the config has a container field
	config, ok := configs[agent]
	if !ok {
		return ac, fmt.Errorf("no config for agent `%s`", agent)
	}
	return config, nil
}