From 3c0928f0a2b9d67aad21947561f034fee37dfb0c Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Thu, 5 May 2022 13:24:42 +0200 Subject: [PATCH] fix linewrap --- docs/helpers/adoc-generator.go.tmpl | 7 ++++--- docs/templates/ADOC.tmpl | 5 ++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/helpers/adoc-generator.go.tmpl b/docs/helpers/adoc-generator.go.tmpl index 07e29c8ce..73e7ac5cc 100644 --- a/docs/helpers/adoc-generator.go.tmpl +++ b/docs/helpers/adoc-generator.go.tmpl @@ -15,7 +15,7 @@ import ( {{- end}}) type ConfigField struct { - Name string + EnvVars []string DefaultValue string Type string Description string @@ -86,8 +86,9 @@ func GetAnnotatedVariables(s interface{}) []ConfigField { if !ok { continue } - v := fmt.Sprintf("%v", value.Interface()) - fields = append(fields, ConfigField{Name: strings.ReplaceAll(env, ";", " +\n"), DefaultValue: v, Description: desc, Type: value.Type().Name()}) + v := fmt.Sprintf("%v", value.Interface()) + td := strings.Split(env, ";") + fields = append(fields, ConfigField{EnvVars: td, 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 diff --git a/docs/templates/ADOC.tmpl b/docs/templates/ADOC.tmpl index 4c01386dd..03633fa07 100644 --- a/docs/templates/ADOC.tmpl +++ b/docs/templates/ADOC.tmpl @@ -8,7 +8,10 @@ | Description {{- range .Fields}} -| `{{.Name}}` +{{ $numVars := len .EnvVars }} +| {{- range $i, $value := .EnvVars }}{{- if $i }} +{{ end }} +`{{- $value }}` +{{- end }} | {{.Type}} | {{.DefaultValue}} | {{.Description}}