This repository was archived by the owner on Apr 10, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +32
-1
lines changed
Expand file tree Collapse file tree 1 file changed +32
-1
lines changed Original file line number Diff line number Diff line change 66# Based on the mode, different default options will be set.
77#
88
9+ file_env () {
10+ local var=" $1 "
11+ local fileVar=" ${var} __FILE"
12+ local def=" ${2:- } "
13+
14+ if [ " ${! var:- } " ] && [ " ${! fileVar:- } " ]; then
15+ echo >&2 " error: both $var and $fileVar are set (but are exclusive)"
16+ exit 1
17+ fi
18+ local val=" $def "
19+ if [ " ${! var:- } " ]; then
20+ val=" ${! var} "
21+ elif [ " ${! fileVar:- } " ]; then
22+ val=" $( < " ${! fileVar} " ) "
23+ fi
24+ export " $var " =" $val "
25+ unset " $fileVar "
26+ }
27+
28+ if [[ " ${DB_USER} " == " root" ]]; then
29+ #
30+ # If this is set to the default, then unset it in case we are going to get it from a secret
31+ #
32+ unset DB_USER
33+ fi
34+
35+ file_env " DB_PASS"
36+ file_env " DB_USER"
37+ file_env " DB_HOST"
38+ file_env " DB_NAME"
39+
940MODE=${MODE:- BACKUP}
1041TARBALL=${TARBALL:- }
1142DB_PORT=${DB_PORT:- 3306}
@@ -43,7 +74,7 @@ echo " UID: ${BACKUP_UID:=666}"
4374echo " GID: ${BACKUP_GID:= 666} "
4475echo " Umask: ${UMASK:= 0022} "
4576echo
46- echo " Base directory: i ${BASE_DIR:=/ backup} "
77+ echo " Base directory: ${BASE_DIR:=/ backup} "
4778[[ " ${MODE^^} " == " RESTORE" ]] && \
4879echo " Restore directory: ${RESTORE_DIR} "
4980echo
You can’t perform that action at this time.
0 commit comments