Change env-to-ini prefix and remove custom prefix (#464)
### Description of the change Change env-to-ini prefix and remove custom prefix. `GITEA` is the default prefix. ### Benefits Compatibility wit v1.20 (`-p` got removed) ### Possible drawbacks None ### Additional information See https://github.com/go-gitea/gitea/pull/25799 Tested with Gitea < 1.20 and >= 1.20 Reviewed-on: gitea/helm-chart#464 Co-authored-by: pat-s <patrick.schratz@gmail.com> Co-committed-by: pat-s <patrick.schratz@gmail.com>
This commit was merged in pull request #464.
This commit is contained in:
@@ -53,14 +53,14 @@ stringData: | ||||
env2ini::log " + '${setting}'" | ||||
| ||||
if [[ -z "${section}" ]]; then | ||||
export "ENV_TO_INI____${setting^^}=${value}" # '^^' makes the variable content uppercase | ||||
export "GITEA____${setting^^}=${value}" # '^^' makes the variable content uppercase | ||||
return | ||||
fi | ||||
| ||||
local masked_section="${section//./_0X2E_}" # '//' instructs to replace all matches | ||||
masked_section="${masked_section//-/_0X2D_}" | ||||
| ||||
export "ENV_TO_INI__${masked_section^^}__${setting^^}=${value}" # '^^' makes the variable content uppercase | ||||
export "GITEA__${masked_section^^}__${setting^^}=${value}" # '^^' makes the variable content uppercase | ||||
} | ||||
| ||||
function env2ini::reload_preset_envs() { | ||||
@@ -134,15 +134,15 @@ stringData: | ||||
# - initially used to set up Gitea | ||||
# Anyway, they won't harm existing app.ini files | ||||
| ||||
export ENV_TO_INI__SECURITY__INTERNAL_TOKEN=$(gitea generate secret INTERNAL_TOKEN) | ||||
export ENV_TO_INI__SECURITY__SECRET_KEY=$(gitea generate secret SECRET_KEY) | ||||
export ENV_TO_INI__OAUTH2__JWT_SECRET=$(gitea generate secret JWT_SECRET) | ||||
export ENV_TO_INI__SERVER__LFS_JWT_SECRET=$(gitea generate secret LFS_JWT_SECRET) | ||||
export GITEA__SECURITY__INTERNAL_TOKEN=$(gitea generate secret INTERNAL_TOKEN) | ||||
export GITEA__SECURITY__SECRET_KEY=$(gitea generate secret SECRET_KEY) | ||||
export GITEA__OAUTH2__JWT_SECRET=$(gitea generate secret JWT_SECRET) | ||||
export GITEA__SERVER__LFS_JWT_SECRET=$(gitea generate secret LFS_JWT_SECRET) | ||||
| ||||
env2ini::log "...Initial secrets generated\n" | ||||
} | ||||
| ||||
env | (grep ENV_TO_INI || [[ $? == 1 ]]) > /tmp/existing-envs | ||||
env | (grep GITEA || [[ $? == 1 ]]) > /tmp/existing-envs | ||||
| ||||
# MUST BE CALLED BEFORE OTHER CONFIGURATION | ||||
env2ini::generate_initial_secrets | ||||
@@ -163,10 +163,10 @@ stringData: | ||||
env2ini::log ' - oauth2.JWT_SECRET' | ||||
env2ini::log ' - server.LFS_JWT_SECRET' | ||||
| ||||
unset ENV_TO_INI__SECURITY__INTERNAL_TOKEN | ||||
unset ENV_TO_INI__SECURITY__SECRET_KEY | ||||
unset ENV_TO_INI__OAUTH2__JWT_SECRET | ||||
unset ENV_TO_INI__SERVER__LFS_JWT_SECRET | ||||
unset GITEA__SECURITY__INTERNAL_TOKEN | ||||
unset GITEA__SECURITY__SECRET_KEY | ||||
unset GITEA__OAUTH2__JWT_SECRET | ||||
unset GITEA__SERVER__LFS_JWT_SECRET | ||||
fi | ||||
| ||||
environment-to-ini -o $GITEA_APP_INI -p ENV_TO_INI | ||||
environment-to-ini -o $GITEA_APP_INI | ||||
| ||||
Reference in New Issue
Block a user