feat: adding dry support to gitea additional config from envs parameter (#840)

### Description of the change

Based on the discussion under https://gitea.com/gitea/helm-gitea/issues/60, it is possible to use `gitea.additionalConfigFromEnvs` to provide variables in order to override configurations from `app.ini`.
Especially when using gitea as a dependency of an umbrella, some values may need to be repeated in multiple places (such has database configuration). Hence, introducing the `tpl` function on `gitea.additionalConfigFromEnvs` will simplify such repetition by having the value only set in one place...

### Benefits

With the same intentions as https://gitea.com/gitea/helm-gitea/pulls/759, https://gitea.com/gitea/helm-gitea/pulls/664, https://gitea.com/gitea/helm-gitea/pulls/529 or https://gitea.com/gitea/helm-gitea/pulls/498, this change will allow reusing the value from other value parameters to avoid duplicating the same value in multiple places.

### Possible drawbacks

N/A

### Applicable issues

N/A

### Additional information

N/A

### Checklist

- [X] Helm templating unittests are added (required when changing anything in `templates` folder)

Co-authored-by: 212597596 <cedric.henry@ge.com>
Co-authored-by: pat-s <pat-s@noreply.gitea.com>
Reviewed-on: https://gitea.com/gitea/helm-gitea/pulls/840
Reviewed-by: pat-s <pat-s@noreply.gitea.com>
Reviewed-by: justusbunsi <justusbunsi@noreply.gitea.com>
Co-authored-by: Ceddaerrix <ceddaerrix@noreply.gitea.com>
Co-committed-by: Ceddaerrix <ceddaerrix@noreply.gitea.com>
This commit is contained in:
Ceddaerrix
2025-03-30 14:30:35 +00:00
committed by justusbunsi
parent d2d542e625
commit 1f313ac70e
3 changed files with 152 additions and 2 deletions

View File

@ -256,7 +256,7 @@ https
{{- end }}
{{- $_ := set $inlines "_generals_" (join "\n" $generals) -}}
{{- toYaml $inlines -}}
{{- tpl (toYaml $inlines) $ -}}
{{- end -}}
{{- define "gitea.inline_configuration.init" -}}

View File

@ -115,7 +115,7 @@ spec:
{{- toYaml .Values.deployment.env | nindent 12 }}
{{- end }}
{{- if .Values.gitea.additionalConfigFromEnvs }}
{{- toYaml .Values.gitea.additionalConfigFromEnvs | nindent 12 }}
{{- tpl (toYaml .Values.gitea.additionalConfigFromEnvs) $ | nindent 12 }}
{{- end }}
volumeMounts:
- name: config