2020-08-23 12:56:55 -05:00
|
|
|
apiVersion: v1
|
|
|
|
kind: ConfigMap
|
|
|
|
metadata:
|
|
|
|
name: {{ include "gitea.fullname" . }}
|
|
|
|
labels:
|
|
|
|
{{- include "gitea.labels" . | nindent 4 }}
|
|
|
|
data:
|
|
|
|
app.ini: |-
|
|
|
|
{{- if not (hasKey .Values.gitea.config "cache") -}}
|
|
|
|
{{- $_ := set .Values.gitea.config "cache" dict -}}
|
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{- if not (hasKey .Values.gitea.config "server") -}}
|
|
|
|
{{- $_ := set .Values.gitea.config "server" dict -}}
|
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{- if not (hasKey .Values.gitea.config "database") -}}
|
|
|
|
{{- $_ := set .Values.gitea.config "database" dict -}}
|
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{- if not (hasKey .Values.gitea.config "security") -}}
|
|
|
|
{{- $_ := set .Values.gitea.config "security" dict -}}
|
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{- /* security default settings */ -}}
|
|
|
|
{{- if not .Values.gitea.config.security.INSTALL_LOCK -}}
|
|
|
|
{{- $_ := set .Values.gitea.config.security "INSTALL_LOCK" "true" -}}
|
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{- /* server default settings */ -}}
|
|
|
|
{{- if not (hasKey .Values.gitea.config.server "HTTP_PORT") -}}
|
|
|
|
{{- $_ := set .Values.gitea.config.server "HTTP_PORT" .Values.service.http.port -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- if not .Values.gitea.config.server.PROTOCOL -}}
|
|
|
|
{{- $_ := set .Values.gitea.config.server "PROTOCOL" "http" -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- if not (.Values.gitea.config.server.DOMAIN) -}}
|
|
|
|
{{- if gt (len .Values.ingress.hosts) 0 -}}
|
|
|
|
{{- $_ := set .Values.gitea.config.server "DOMAIN" (index .Values.ingress.hosts 0) -}}
|
|
|
|
{{- else -}}
|
|
|
|
{{- $_ := set .Values.gitea.config.server "DOMAIN" (include "gitea.default_domain" .) -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- if not .Values.gitea.config.server.ROOT_URL -}}
|
|
|
|
{{- if .Values.ingress.enabled -}}
|
|
|
|
{{- if gt (len .Values.ingress.tls) 0 -}}
|
|
|
|
{{- $_ := set .Values.gitea.config.server "ROOT_URL" (printf "%s://%s" .Values.gitea.config.server.PROTOCOL (index (index .Values.ingress.tls 0).hosts 0)) -}}
|
|
|
|
{{- else -}}
|
|
|
|
{{- $_ := set .Values.gitea.config.server "ROOT_URL" (printf "%s://%s" .Values.gitea.config.server.PROTOCOL (index .Values.ingress.hosts 0)) -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- else -}}
|
|
|
|
{{- $_ := set .Values.gitea.config.server "ROOT_URL" (printf "%s://%s" .Values.gitea.config.server.PROTOCOL .Values.gitea.config.server.DOMAIN) -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- if not .Values.gitea.config.server.SSH_DOMAIN -}}
|
|
|
|
{{- $_ := set .Values.gitea.config.server "SSH_DOMAIN" .Values.gitea.config.server.DOMAIN -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- if not .Values.gitea.config.server.SSH_PORT -}}
|
|
|
|
{{- $_ := set .Values.gitea.config.server "SSH_PORT" .Values.service.ssh.port -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- if not (hasKey .Values.gitea.config.server "SSH_LISTEN_PORT") -}}
|
|
|
|
{{- $_ := set .Values.gitea.config.server "SSH_LISTEN_PORT" .Values.gitea.config.server.SSH_PORT -}}
|
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{- /* database default settings */ -}}
|
|
|
|
{{- if .Values.gitea.database.builtIn.postgresql.enabled -}}
|
|
|
|
{{- $_ := set .Values.gitea.config.database "DB_TYPE" "postgres" -}}
|
2020-09-17 22:21:29 -05:00
|
|
|
{{- if not (.Values.gitea.config.database.HOST) -}}
|
2020-08-23 12:56:55 -05:00
|
|
|
{{- $_ := set .Values.gitea.config.database "HOST" (include "postgresql.dns" .) -}}
|
2020-09-17 22:21:29 -05:00
|
|
|
{{- end -}}
|
2020-08-23 12:56:55 -05:00
|
|
|
{{- $_ := 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" -}}
|
2020-09-17 22:21:29 -05:00
|
|
|
{{- if not (.Values.gitea.config.database.HOST) -}}
|
2020-08-23 12:56:55 -05:00
|
|
|
{{- $_ := set .Values.gitea.config.database "HOST" (include "mysql.dns" .) -}}
|
2020-09-17 22:21:29 -05:00
|
|
|
{{- end -}}
|
2020-08-23 12:56:55 -05:00
|
|
|
{{- $_ := 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 -}}
|
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{- /* cache default settings */ -}}
|
|
|
|
{{- if .Values.gitea.cache.builtIn.enabled -}}
|
|
|
|
{{- $_ := set .Values.gitea.config.cache "ENABLED" "true" -}}
|
|
|
|
{{- $_ := set .Values.gitea.config.cache "ADAPTER" "memcache" -}}
|
2020-09-17 22:21:29 -05:00
|
|
|
{{- if not (.Values.gitea.config.cache.HOST) -}}
|
2020-08-23 12:56:55 -05:00
|
|
|
{{- $_ := set .Values.gitea.config.cache "HOST" (include "memcached.dns" .) -}}
|
|
|
|
{{- end -}}
|
2020-09-17 22:21:29 -05:00
|
|
|
{{- end -}}
|
2020-08-23 12:56:55 -05:00
|
|
|
|
|
|
|
{{- /* autogenerate app.ini */ -}}
|
|
|
|
{{- range $key, $value := .Values.gitea.config }}
|
|
|
|
{{- if kindIs "map" $value }}
|
|
|
|
{{- if gt (len $value) 0 }}
|
|
|
|
|
|
|
|
[{{ $key }}]
|
|
|
|
{{- range $n_key, $n_value := $value }}
|
|
|
|
{{ $n_key | upper }} = {{ $n_value }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
{{- else }}
|
|
|
|
{{ $key | upper }} = {{ $value }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|