-
Notifications
You must be signed in to change notification settings - Fork 0
/
dataloader
54 lines (44 loc) · 1.04 KB
/
dataloader
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
encryption_key() {
CMD="com.salesforce.dataloader.security.EncryptionUtil"
KEY="configs/encryption.key"
if [ ! -f "$KEY" ]; then
jar "$CMD" "-k" "$KEY"
fi
jar "$CMD" "$1" "$2" "$KEY"
}
jar() {
java -cp dataloader.jar:/opt/app/libs/* "${@:1}"
}
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.DataLoaderRunner"
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
jar "$CMD" "salesforce.config.dir=configs/$2" "run.mode=batch" "process.name=$3"
;;
*)
echo "Invalid operation. You must specify either 'decrypt', 'encrypt' or 'process'."
exit 0
esac