-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.sh
executable file
·50 lines (42 loc) · 1007 Bytes
/
setup.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
#!/bin/bash
set -e
function usage() {
cat <<USAGE
Usage: $0 [-u upload] or [-d download]
Options:
-u, --upload: Upload env files from local to s3
-d --download: download env files locally from S3
USAGE
exit 1
}
if [ $# -eq 0 ]; then
usage
exit 1
fi
BUCKET_NAME="lhcloudybot-config"
export AWS_PROFILE="default"
while [ "$1" != "" ]; do
case $1 in
-u | --upload)
echo "Uploading files to S3"
aws s3 cp ./infrastructure/terraform/bot/terraform.tfvars s3://$BUCKET_NAME/terraform.tfvars
aws s3 cp ./.env s3://$BUCKET_NAME/.env
echo "Done"
;;
-d | --download)
shift
echo "Downloading files from S3"
aws s3 cp s3://$BUCKET_NAME/terraform.tfvars ./infrastructure/terraform/bot/terraform.tfvars
aws s3 cp s3://$BUCKET_NAME/.env ./.env
echo "Done"
;;
-h | --help)
usage
;;
*)
usage
exit 1
;;
esac
shift
done