Made ReadProfilingKey method public and more generic (#852)

* Made ReadProfilingKey method public and more generic

* Removed old readProfilingFlag
This commit is contained in:
Francesco Guardiani 2019-11-07 15:31:56 +01:00 committed by Knative Prow Robot
parent 285df36be4
commit f0da42d387
1 changed files with 3 additions and 3 deletions

View File

@ -76,8 +76,8 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}
}
func readProfilingFlag(configMap *corev1.ConfigMap) (bool, error) {
profiling, ok := configMap.Data[profilingKey]
func ReadProfilingFlag(config map[string]string) (bool, error) {
profiling, ok := config[profilingKey]
if !ok {
return false, nil
}
@ -91,7 +91,7 @@ func readProfilingFlag(configMap *corev1.ConfigMap) (bool, error) {
// UpdateFromConfigMap modifies the Enabled flag in the Handler
// according to the value in the given ConfigMap
func (h *Handler) UpdateFromConfigMap(configMap *corev1.ConfigMap) {
enabled, err := readProfilingFlag(configMap)
enabled, err := ReadProfilingFlag(configMap.Data)
if err != nil {
h.log.Errorw("Failed to update the profiling flag", zap.Error(err))
return