From 0d875d30b752fe64358cc64aafaae43636481fa6 Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Tue, 3 May 2022 11:12:37 +0200 Subject: [PATCH] Add pointers to the config var extractor Co-authored-by: David Christofas Signed-off-by: Christian Richter --- docs/helpers/extractor.go.tmpl | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/helpers/extractor.go.tmpl b/docs/helpers/extractor.go.tmpl index 501e1938b..699d13131 100644 --- a/docs/helpers/extractor.go.tmpl +++ b/docs/helpers/extractor.go.tmpl @@ -37,7 +37,7 @@ tpl := template.Must(template.New("").Parse(string(content))) m := map[string]interface{}{ {{- range $key, $value := .}} - "{{$value}}": *pkg{{$key}}.DefaultConfig(), + "{{$value}}": *pkg{{$key}}.FullDefaultConfig(), {{- end }} } @@ -77,6 +77,14 @@ func GetAnnotatedVariables(s interface{}) []ConfigField { } v := fmt.Sprintf("%v", value.Interface()) fields = append(fields, ConfigField{Name: env, DefaultValue: v, Description: desc, Type: value.Type().Name()}) + case reflect.Ptr: + // PolicySelectors in the Proxy are being skipped atm + // they are not configurable via env vars, if that changes + // they are probably added to the Sanitize() function + // and this should not be an issue then + if !value.IsZero() && value.Elem().CanInterface() { + fields = append(fields, GetAnnotatedVariables(value.Elem().Interface())...) + } case reflect.Struct: fields = append(fields, GetAnnotatedVariables(value.Interface())...) }