100 lines
4.5 KiB
YAML
100 lines
4.5 KiB
YAML
|
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" -}}
|
||
|
{{- $_ := set .Values.gitea.config.database "HOST" (include "postgresql.dns" .) -}}
|
||
|
{{- $_ := 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" -}}
|
||
|
{{- $_ := set .Values.gitea.config.database "HOST" (include "mysql.dns" .) -}}
|
||
|
{{- $_ := 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" -}}
|
||
|
{{- $_ := set .Values.gitea.config.cache "HOST" (include "memcached.dns" .) -}}
|
||
|
{{- end -}}
|
||
|
|
||
|
{{- /* 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 }}
|