[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
@@ -35,15 +35,18 @@ function env2ini::read_config_to_env() {
|
||||
|
||||
env2ini::log " + '${setting}'"
|
||||
|
||||
local masked_setting="${setting//./_0X2E_}"
|
||||
masked_setting="${masked_setting//-/_0X2D_}"
|
||||
|
||||
if [[ -z "${section}" ]]; then
|
||||
export "GITEA____${setting^^}=${value}" # '^^' makes the variable content uppercase
|
||||
export "GITEA____${masked_setting}=${value}"
|
||||
return
|
||||
fi
|
||||
|
||||
local masked_section="${section//./_0X2E_}" # '//' instructs to replace all matches
|
||||
masked_section="${masked_section//-/_0X2D_}"
|
||||
|
||||
export "GITEA__${masked_section^^}__${setting^^}=${value}" # '^^' makes the variable content uppercase
|
||||
export "GITEA__${masked_section^^}__${masked_setting}=${value}"
|
||||
}
|
||||
|
||||
function env2ini::reload_preset_envs() {
|
||||
@@ -75,7 +78,15 @@ function env2ini::reload_preset_envs() {
|
||||
|
||||
env2ini::log " + '${setting}'"
|
||||
|
||||
export "${setting^^}=${value}" # '^^' makes the variable content uppercase
|
||||
local section_and_key="${setting#GITEA__}"
|
||||
if [[ "${section_and_key}" == *'__'* ]]; then
|
||||
local section="${section_and_key%%__*}"
|
||||
local key="${section_and_key#*__}"
|
||||
unset "${setting}"
|
||||
export "GITEA__${section^^}__${key}=${value}"
|
||||
else
|
||||
export "${setting}=${value}"
|
||||
fi
|
||||
done < "$TMP_EXISTING_ENVS_FILE"
|
||||
|
||||
rm "$TMP_EXISTING_ENVS_FILE"
|
||||
|
||||
Reference in new issue
Block a user