[Close #1077] fix: preserve config key casing
Gitea requires case-sensitive setting names and escaped punctuation to interpret configuration keys correctly. Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
2 files changed
+47
-12
No files matched your search
@@ -158,6 +158,17 @@ function write_mounted_file() {
|
||||
refute_line '+GITEA__OAUTH2__JWT_SECRET=mocked-jwt-secret'
|
||||
}
|
||||
|
||||
@test "ensures that preset secrets with lowercase sections override generated secrets" {
|
||||
expect_gitea_config_edit_ini_call
|
||||
export GITEA__oauth2__JWT_SECRET="pre-defined-jwt-secret"
|
||||
|
||||
run execute_test_script
|
||||
|
||||
assert_success
|
||||
assert_line '+GITEA__OAUTH2__JWT_SECRET=pre-defined-jwt-secret'
|
||||
refute_line '+GITEA__OAUTH2__JWT_SECRET=mocked-jwt-secret'
|
||||
}
|
||||
|
||||
@test "ensures that preset environment variables take precedence over mounted ones" {
|
||||
expect_gitea_config_edit_ini_call
|
||||
export GITEA__OAUTH2__JWT_SECRET="pre-defined-jwt-secret"
|
||||
@@ -205,22 +216,35 @@ EOF
|
||||
assert_line '+GITEA__REPOSITORY_0X2E_PULL_0X2D_REQUEST__WORK_IN_PROGRESS_PREFIXES=WIP:,[WIP]'
|
||||
}
|
||||
|
||||
###############################################################
|
||||
##### THIS IS A BUG, BUT I WANT IT TO BE COVERED BY TESTS #####
|
||||
###############################################################
|
||||
@test "ensures uppercase section and setting names (🐞)" {
|
||||
@test "preserves the case of setting names and masks dots and dashes" {
|
||||
expect_gitea_config_edit_ini_call
|
||||
export GITEA__oauth2__JwT_Secret="pre-defined-jwt-secret"
|
||||
write_mounted_file "inlines" "repository.pull-request" "$(cat << EOF
|
||||
WORK_IN_progress_PREFIXES=WIP:,[WIP]
|
||||
write_mounted_file "inlines" "log" "$(cat << EOF
|
||||
logger.router.MODE=console-warn
|
||||
Mixed-Case=value
|
||||
EOF
|
||||
)"
|
||||
|
||||
run execute_test_script
|
||||
|
||||
assert_success
|
||||
assert_line '+GITEA__REPOSITORY_0X2E_PULL_0X2D_REQUEST__WORK_IN_PROGRESS_PREFIXES=WIP:,[WIP]'
|
||||
assert_line '+GITEA__OAUTH2__JWT_SECRET=pre-defined-jwt-secret'
|
||||
assert_line '+GITEA__LOG__logger_0X2E_router_0X2E_MODE=console-warn'
|
||||
assert_line '+GITEA__LOG__Mixed_0X2D_Case=value'
|
||||
}
|
||||
|
||||
@test "preserves preset setting case and its precedence over mounted values" {
|
||||
expect_gitea_config_edit_ini_call
|
||||
export GITEA__log__MixedKey="preset"
|
||||
write_mounted_file "inlines" "log" "$(cat << EOF
|
||||
MixedKey=inline
|
||||
EOF
|
||||
)"
|
||||
|
||||
run execute_test_script
|
||||
|
||||
assert_success
|
||||
assert_line '-GITEA__log__MixedKey=preset'
|
||||
assert_line '+GITEA__LOG__MixedKey=preset'
|
||||
refute_line '+GITEA__LOG__MixedKey=inline'
|
||||
}
|
||||
|
||||
@test "treats top-level configuration as section-less" {
|
||||
|
||||
Reference in new issue
Block a user