Increase testability of shell scripts (#752)
This is a preparation for #724 (bash script testing) which would be too complex to review if done there. Reviewed-on: https://gitea.com/gitea/helm-chart/pulls/752 Co-authored-by: justusbunsi <sk.bunsenbrenner@gmail.com> Co-committed-by: justusbunsi <sk.bunsenbrenner@gmail.com>
This commit is contained in:
@ -73,9 +73,9 @@ function env2ini::reload_preset_envs() {
|
||||
env2ini::log " + '${setting}'"
|
||||
|
||||
export "${setting^^}=${value}" # '^^' makes the variable content uppercase
|
||||
done < "/tmp/existing-envs"
|
||||
done < "$TMP_EXISTING_ENVS_FILE"
|
||||
|
||||
rm /tmp/existing-envs
|
||||
rm $TMP_EXISTING_ENVS_FILE
|
||||
}
|
||||
|
||||
|
||||
@ -124,13 +124,13 @@ function env2ini::generate_initial_secrets() {
|
||||
}
|
||||
|
||||
# save existing envs prior to script execution. Necessary to keep order of preexisting and custom envs
|
||||
env | (grep -e '^GITEA__' || [[ $? == 1 ]]) > /tmp/existing-envs
|
||||
env | (grep -e '^GITEA__' || [[ $? == 1 ]]) > $TMP_EXISTING_ENVS_FILE
|
||||
|
||||
# MUST BE CALLED BEFORE OTHER CONFIGURATION
|
||||
env2ini::generate_initial_secrets
|
||||
|
||||
env2ini::load_config_sources '/env-to-ini-mounts/inlines/'
|
||||
env2ini::load_config_sources '/env-to-ini-mounts/additionals/'
|
||||
env2ini::load_config_sources "$ENV_TO_INI_MOUNT_POINT/inlines/"
|
||||
env2ini::load_config_sources "$ENV_TO_INI_MOUNT_POINT/additionals/"
|
||||
|
||||
# load existing envs to override auto generated envs
|
||||
env2ini::reload_preset_envs
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eu
|
||||
|
||||
gpg --batch --import /raw/private.asc
|
||||
gpg --batch --import "$TMP_RAW_GPG_KEY"
|
||||
|
Reference in New Issue
Block a user