-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdb-import.cmd
More file actions
executable file
·50 lines (44 loc) · 1.2 KB
/
Copy pathdb-import.cmd
File metadata and controls
executable file
·50 lines (44 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env bash
[[ ! "${WARDEN_DIR:-}" ]] && >&2 printf "\033[31mThis script is not intended to be run directly!\033[0m\n" && exit 1
SUBCOMMAND_DIR=$(dirname "${BASH_SOURCE[0]}")
source "${SUBCOMMAND_DIR}"/env-variables
# Default values
STREAM_DB=0
SYNC_DB_NO_NOISE=0
SYNC_DB_NO_PII=0
# Parse remaining arguments
while (( "$#" )); do
case "$1" in
--stream-db)
STREAM_DB=1
shift
;;
--no-noise)
SYNC_DB_NO_NOISE=1
shift
;;
--no-pii)
SYNC_DB_NO_PII=1
shift
;;
--) # End of all options
shift
WARDEN_PARAMS+=("$@")
break
;;
*)
WARDEN_PARAMS+=("$1")
shift
;;
esac
done
export STREAM_DB SYNC_DB_NO_NOISE SYNC_DB_NO_PII
# Load environment-specific db-import command
ENV_DB_IMPORT="${SUBCOMMAND_DIR}/env-adapters/${WARDEN_ENV_TYPE}/db-import.cmd"
if [[ -f "${ENV_DB_IMPORT}" ]]; then
source "${ENV_DB_IMPORT}"
else
>&2 printf "Error: No db-import command found for environment type '%s'\n" "${WARDEN_ENV_TYPE}"
>&2 printf "Expected: %s\n" "${ENV_DB_IMPORT}"
exit 1
fi