[Close #1117] feat: support rebuilding app.ini
Bash / bash-unittest (push) Successful in 18s
Bash / shellcheck (push) Successful in 21s
changelog / changelog (push) Successful in 12s
Helm / helm-lint (push) Successful in 14s
Helm / helm-unittest (push) Successful in 19s
Markdown linter / markdown-lint (push) Successful in 14s
Markdown linter / markdown-link-checker (push) Successful in 51s

Allow stale settings to be removed on startup while preserving existing Gitea secret keys.

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
volker.raschekandCopilot committed 2026-12-04 21:41:59 +01:00
1 parent 1779e3b525
commit ffd2ba1d77
7 files changed
+91 -5

No files matched your search

@@ -158,4 +158,11 @@ if [ -f "${GITEA_APP_INI}" ]; then
unset GITEA__SERVER__LFS_JWT_SECRET
fi
gitea config edit-ini --apply-env --config "$GITEA_APP_INI" --out "$GITEA_APP_INI"
if [[ "${GITEA_REBUILD_APP_INI:-false}" == "true" && -f "${GITEA_APP_INI}" ]]; then
keep_keys_file="$(mktemp)"
trap 'rm -f "${keep_keys_file}"' EXIT
printf '%s\n' '[security]' 'SECRET_KEY=' 'INTERNAL_TOKEN=' '[oauth2]' 'JWT_SECRET=' '[server]' 'LFS_JWT_SECRET=' > "${keep_keys_file}"
gitea config edit-ini --apply-env --config "$GITEA_APP_INI" --config-keep-keys "${keep_keys_file}" --out "$GITEA_APP_INI"
else
gitea config edit-ini --apply-env --config "$GITEA_APP_INI" --out "$GITEA_APP_INI"
fi