From c168d471810eb3e5f97b71628a0c7e99a2c27775 Mon Sep 17 00:00:00 2001 From: mmuenster Date: Fri, 18 Sep 2020 03:21:29 +0000 Subject: [PATCH] Prevent custom HOST name from being overwritten in mysql, postgresql, cache (#23) Adding same changes to cache Deleted useDefaultHost value no longer needed Eliminated need for useDefaultHost value Using whether gitea.config.database.HOST exists instead in the values file. If true, don't overwrite. If false, use "mysql/postgresql.dns" Updated db host logic Config map uses "postgresql/mysql.dns" when useDefaultHost is true, and the value from gitea.config.database.HOST when useDefaultHost is false. Added useDefaultHost to built in database values. Reviewed-on: https://gitea.com/gitea/helm-chart/pulls/23 Reviewed-by: Lunny Xiao Reviewed-by: techknowlogick --- templates/gitea/config.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/templates/gitea/config.yaml b/templates/gitea/config.yaml index 825d612..b882920 100644 --- a/templates/gitea/config.yaml +++ b/templates/gitea/config.yaml @@ -65,13 +65,17 @@ data: {{- /* database default settings */ -}} {{- if .Values.gitea.database.builtIn.postgresql.enabled -}} {{- $_ := set .Values.gitea.config.database "DB_TYPE" "postgres" -}} + {{- if not (.Values.gitea.config.database.HOST) -}} {{- $_ := set .Values.gitea.config.database "HOST" (include "postgresql.dns" .) -}} + {{- end -}} {{- $_ := set .Values.gitea.config.database "NAME" .Values.postgresql.global.postgresql.postgresqlDatabase -}} {{- $_ := set .Values.gitea.config.database "USER" .Values.postgresql.global.postgresql.postgresqlUsername -}} {{- $_ := set .Values.gitea.config.database "PASSWD" .Values.postgresql.global.postgresql.postgresqlPassword -}} {{ else if .Values.gitea.database.builtIn.mysql.enabled -}} {{- $_ := set .Values.gitea.config.database "DB_TYPE" "mysql" -}} + {{- if not (.Values.gitea.config.database.HOST) -}} {{- $_ := set .Values.gitea.config.database "HOST" (include "mysql.dns" .) -}} + {{- end -}} {{- $_ := set .Values.gitea.config.database "NAME" .Values.mysql.db.name -}} {{- $_ := set .Values.gitea.config.database "USER" .Values.mysql.db.user -}} {{- $_ := set .Values.gitea.config.database "PASSWD" .Values.mysql.db.password -}} @@ -81,8 +85,10 @@ data: {{- if .Values.gitea.cache.builtIn.enabled -}} {{- $_ := set .Values.gitea.config.cache "ENABLED" "true" -}} {{- $_ := set .Values.gitea.config.cache "ADAPTER" "memcache" -}} + {{- if not (.Values.gitea.config.cache.HOST) -}} {{- $_ := set .Values.gitea.config.cache "HOST" (include "memcached.dns" .) -}} {{- end -}} + {{- end -}} {{- /* autogenerate app.ini */ -}} {{- range $key, $value := .Values.gitea.config }}