mirror of https://github.com/knative/pkg.git
Made ReadProfilingKey method public and more generic (#852)
* Made ReadProfilingKey method public and more generic * Removed old readProfilingFlag
This commit is contained in:
parent
285df36be4
commit
f0da42d387
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue