Add secret key generation
This commit is contained in:
@@ -7,7 +7,9 @@ metadata: | ||||
type: Opaque | ||||
stringData: | ||||
config_environment.sh: |- | ||||
#!/bin/bash | ||||
#!/usr/bin/env bash | ||||
set -euo pipefail | ||||
| ||||
{{- if not (hasKey .Values.gitea.config "cache") -}} | ||||
{{- $_ := set .Values.gitea.config "cache" dict -}} | ||||
{{- end -}} | ||||
@@ -32,6 +34,10 @@ stringData: | ||||
{{- $_ := set .Values.gitea.config "repository" dict -}} | ||||
{{- end -}} | ||||
| ||||
{{- if not (hasKey .Values.gitea.config "oauth2") -}} | ||||
{{- $_ := set .Values.gitea.config "oauth2" dict -}} | ||||
{{- end -}} | ||||
| ||||
{{- /* repository default settings */ -}} | ||||
{{- if not .Values.gitea.config.repository.ROOT -}} | ||||
{{- $_ := set .Values.gitea.config.repository "ROOT" "/data/git/gitea-repositories" -}} | ||||
@@ -146,4 +152,16 @@ stringData: | ||||
{{- end }} | ||||
{{- end }} | ||||
| ||||
if [ ! -f ${GITEA_APP_INI} ]; then | ||||
{{- if not (hasKey .Values.gitea.config.security "INTERNAL_TOKEN") }} | ||||
export ENV_TO_INI__SECURITY__INTERNAL_TOKEN=$(gitea generate secret INTERNAL_TOKEN) | ||||
{{- end }} | ||||
{{- if not (hasKey .Values.gitea.config.security "SECRET_KEY") }} | ||||
export ENV_TO_INI__SECURITY__SECRET_KEY=$(gitea generate secret SECRET_KEY) | ||||
{{- end }} | ||||
{{- if not (hasKey .Values.gitea.config.oauth2 "JWT_SECRET") }} | ||||
export ENV_TO_INI__OAUTH2__JWT_SECRET=$(gitea generate secret JWT_SECRET) | ||||
{{- end }} | ||||
fi | ||||
| ||||
environment-to-ini -o $GITEA_APP_INI -p ENV_TO_INI | ||||
| ||||
Reference in New Issue
Block a user