Pass /tmp/existing-envs via environment variable

This helps to unittest the script

Signed-off-by: justusbunsi <sk.bunsenbrenner@gmail.com>
This commit is contained in:
2024-11-10 20:51:04 +01:00
parent f4edc173be
commit a4e3d75345
2 changed files with 5 additions and 3 deletions

View File

@ -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,7 +124,7 @@ 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

View File

@ -107,6 +107,8 @@ spec:
value: /data
- name: GITEA_TEMP
value: /tmp/gitea
- name: TMP_EXISTING_ENVS_FILE
value: /tmp/existing-envs
{{- if .Values.deployment.env }}
{{- toYaml .Values.deployment.env | nindent 12 }}
{{- end }}