-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathupdate_amplify.sh
executable file
·90 lines (83 loc) · 2.07 KB
/
update_amplify.sh
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/bin/bash
set -e
IFS='|'
# Read arguments passed to a script:
while getopts a:s:i:e:t:r:h flag
do
case "${flag}" in
a)
# echo "Processing option 'a' with '${OPTARG}' argument"
AWS_ACCESS_KEY_ID=${OPTARG}
;;
s)
# echo "Processing option 's' with '${OPTARG}' argument"
AWS_SECRET_ACCESS_KEY=${OPTARG}
;;
i)
# echo "Processing option 'i' with '${OPTARG}' argument"
APP_ID=${OPTARG}
;;
e)
# echo "Processing option 'e' with '${OPTARG}' argument"
AMPLIFY_ENV=${OPTARG}
;;
t)
# echo "Processing option 't' with '${OPTARG}' argument"
FACEBOOK_CLIENT_ID=${OPTARG}
;;
r)
# echo "Processing option 'r' with '${OPTARG}' argument"
FACEBOOK_CLIENT_SECRET=${OPTARG}
;;
?|h)
echo "Usage: $(basename $0) [a arg] [s arg] [i arg] [e arg] [t arg] [r arg]"
exit 1
;;
esac
done
# For debug purposes
# echo "AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID";
# echo "AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY";
# echo "APP_ID: $APP_ID";
# echo "AMPLIFY_ENV: $AMPLIFY_ENV";
# echo "FACEBOOK_CLIENT_ID: $FACEBOOK_CLIENT_ID";
# echo "FACEBOOK_CLIENT_SECRET: $FACEBOOK_CLIENT_SECRET";
AWSCLOUDFORMATIONCONFIG="{\
\"configLevel\":\"project\",\
\"useProfile\":false,\
\"profileName\":\"default\",\
\"accessKeyId\":\"$AWS_ACCESS_KEY_ID\",\
\"secretAccessKey\":\"$AWS_SECRET_ACCESS_KEY\",\
\"region\":\"us-east-1\"\
}"
AMPLIFY="{\
\"projectName\":\"animeal\",\
\"envName\":\"$AMPLIFY_ENV\",\
\"defaultEditor\":\"Xcode\"\
\"appId\":\"$APP_ID\",\
}"
FRONTEND="{\
\"frontend\":\"ios\",\
}"
PROVIDERS="{\
\"awscloudformation\":$AWSCLOUDFORMATIONCONFIG\
}"
AUTHCONFIG="{\
\"facebookAppIdUserPool\":\"${FACEBOOK_CLIENT_ID}\",\
\"facebookAppSecretUserPool\":\"${FACEBOOK_CLIENT_SECRET}\"\
}"
CATEGORIES="{\
\"auth\":$AUTHCONFIG\
}"
# For debug purposes
echo $AMPLIFY
echo $FRONTEND
echo $PROVIDERS
echo $AWSCLOUDFORMATIONCONFIG
echo $CATEGORIES
amplify pull \
--amplify $AMPLIFY \
--frontend $FRONTEND \
--providers $PROVIDERS \
--categories $CATEGORIES \
--yes