-
Notifications
You must be signed in to change notification settings - Fork 0
/
dataloader.50
54 lines (44 loc) · 1.22 KB
/
dataloader.50
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
51
52
53
54
#!/bin/bash
set -e
dataloader() {
java -cp dataloader.jar:/opt/app/libs/* -Dsalesforce.config.dir="${1}" "${@:2}"
}
encryption_key() {
CMD="com.salesforce.dataloader.security.EncryptionUtil"
KEY="configs/encryption.key"
if [ ! -f "$KEY" ]; then
dataloader "configs" "$CMD" "-k" "$KEY"
fi
dataloader "configs" "$CMD" "$1" "$2" "$KEY"
}
case "$1" in
"decrypt")
if [ -z "$2" ]; then
echo "You must provide the string to decrypt"
exit 0
fi
encryption_key "-d" "$2"
;;
"encrypt")
if [ -z "$2" ]; then
echo "You must provide the string to encrypt"
exit 0
fi
encryption_key "-e" "$2"
;;
"process")
CMD="com.salesforce.dataloader.process.ProcessRunner"
if [ -z "$2" ]; then
echo "You must provide the configs/ config folder"
exit 0
fi
if [ -z "$3" ]; then
echo "You must provide the process name"
exit 0
fi
dataloader "configs/$2" "$CMD" "process.name=$3"
;;
*)
echo "Invalid operation. You must specify either 'decrypt', 'encrypt' or 'process'."
exit 0
esac