<p>I did Helm Chart helper file as follows:</p>
<pre><code>{{- define &quot;logging.log_path&quot; -}}
{{- if and .Values.log_path (eq .Values.app_type &quot;sales&quot;) }}
{{- join &quot;,&quot; .Values.log_path.sales }}
{{ else if and .Values.log_path (eq .Values.app_type &quot;inventory&quot;) }}
{{- join &quot;,&quot; .Values.log_path.inventory }}
{{ else if and .Values.log_path (eq .Values.app_type &quot;order&quot;) }}
{{- join &quot;,&quot; .Values.log_path.order }}
{{ else if and .Values.log_path (eq .Values.app_type &quot;warehouse&quot;) }}
{{- join &quot;,&quot; .Values.log_path.warehouse }}
{{ else }}
{{- join &quot;,&quot; .Values.log_path.sales }}
{{- end }}
{{- end }}
</code></pre>
<p>The problem is whenever it's required to add new <code>app_type</code>, I need to add <code>app_type</code> in that file manually. I think it's difficult to maintain and time consuming either.</p>
<p>Is there anyway that I could do like that <code>.Values.log_path[&quot;.Values.app_type&quot;]</code> or any solution similar to that one? Thanks.</p>

<p>Helm includes a <a href="https://helm.sh/docs/chart_template_guide/function_list/#dictionaries-and-dict-functions" rel="nofollow noreferrer">dictionary helper</a> <a href="https://helm.sh/docs/chart_template_guide/function_list/#get" rel="nofollow noreferrer"><code>get</code></a></p>
<p><code>get $myDict &quot;key1&quot;</code></p>
<pre><code>{{ define &quot;logging.log_path&quot; }}
{{- $path := get .Values.log_path .Values.app_type | default .Values.log_path.sales -}}
{{- join &quot;,&quot; $path -}}
{{ end }}
</code></pre>
