Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12231

Parsing file into helm template

$
0
0

I try parsing file

VAR1=https://com.domVAR2=abcd=efg=

by template

{{- range $path, $_ :=  $.Files.Glob $envPath }}    {{- range split "\n" ($.Files.Get $path) }}      {{- if . }}        {{- $kv := splitList "=" . -}}          {{- $k := first $kv}}          {{- if contains "RAW_" $k }}            {{- first $kv | replace "RAW_" "" | nindent 2}}: {{last $kv | quote }}            {{ else}}            {{- first $kv | nindent 2}}: {{last $kv | replace "'" "" | b64enc | quote }}          {{-  end }}  {{-  end }}    {{- end }}{{- end }}{{- end }}

and got

data:  VAR1: "aHR0cHM6Ly9jb20uZG9t"  VAR2: ""

becouse splitList get last "=", but I want that splitList take only first "=" will take as seporator.note: base64 have "=" at your hashes.


Viewing all articles
Browse latest Browse all 12231

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>