[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
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:
7 files changed
+91
-5
No files matched your search
@@ -30,6 +30,11 @@ case "$*" in
|
||||
'generate secret LFS_JWT_SECRET')
|
||||
echo 'mocked-lfs-jwt-secret'
|
||||
;;
|
||||
"config edit-ini --apply-env --config $GITEA_APP_INI --config-keep-keys "*" --out $GITEA_APP_INI")
|
||||
test "$GITEA_EDIT_INI_EXPECTED" -eq 1
|
||||
cat "$7"
|
||||
echo 'Stubbed gitea config edit-ini rebuild was called!'
|
||||
;;
|
||||
"config edit-ini --apply-env --config $GITEA_APP_INI --out $GITEA_APP_INI")
|
||||
if [ "$GITEA_EDIT_INI_EXPECTED" -eq 1 ]; then
|
||||
echo 'Stubbed gitea config edit-ini was called!'
|
||||
@@ -115,6 +120,34 @@ function write_mounted_file() {
|
||||
refute_line '+GITEA__SERVER__LFS_JWT_SECRET=mocked-lfs-jwt-secret'
|
||||
}
|
||||
|
||||
@test "rebuilds an existing app.ini while preserving secret keys" {
|
||||
expect_gitea_config_edit_ini_call
|
||||
export GITEA_REBUILD_APP_INI=true
|
||||
touch "$GITEA_APP_INI"
|
||||
|
||||
run "$PROJECT_ROOT/scripts/init-containers/config/config_environment.sh"
|
||||
|
||||
assert_success
|
||||
assert_line '[security]'
|
||||
assert_line 'SECRET_KEY='
|
||||
assert_line 'INTERNAL_TOKEN='
|
||||
assert_line '[oauth2]'
|
||||
assert_line 'JWT_SECRET='
|
||||
assert_line '[server]'
|
||||
assert_line 'LFS_JWT_SECRET='
|
||||
assert_line 'Stubbed gitea config edit-ini rebuild was called!'
|
||||
}
|
||||
|
||||
@test "uses normal initialization when rebuild is enabled for a new app.ini" {
|
||||
expect_gitea_config_edit_ini_call
|
||||
export GITEA_REBUILD_APP_INI=true
|
||||
|
||||
run "$PROJECT_ROOT/scripts/init-containers/config/config_environment.sh"
|
||||
|
||||
assert_success
|
||||
assert_line 'Stubbed gitea config edit-ini was called!'
|
||||
}
|
||||
|
||||
@test "ensures that preset environment variables take precedence over auto-generated ones" {
|
||||
expect_gitea_config_edit_ini_call
|
||||
export GITEA__OAUTH2__JWT_SECRET="pre-defined-jwt-secret"
|
||||
|
||||
Reference in new issue
Block a user