-
Notifications
You must be signed in to change notification settings - Fork 119
/
pull_backend_config_from_s3
executable file
·84 lines (69 loc) · 3.35 KB
/
pull_backend_config_from_s3
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
#!/bin/bash
set -x
set -e
# This bucket contains a collection of config files that are used by the
# integration tests. The configuration files contain sensitive
# tokens/credentials/identifiers, so are not published publicly.
readonly config_bucket=$1
readonly config_files=(
# Core
"core/src/androidTest/res/raw/amplifyconfiguration.json"
# Analytics
"aws-analytics-pinpoint/src/androidTest/res/raw/amplifyconfiguration.json"
"aws-analytics-pinpoint/src/androidTest/res/raw/awsconfiguration.json"
"aws-analytics-pinpoint/src/androidTest/res/raw/credentials.json"
"aws-analytics-pinpoint/src/androidTest/res/raw/amplify_outputs.json"
# API
"aws-api/src/androidTest/res/raw/amplifyconfiguration.json"
"aws-api/src/androidTest/res/raw/awsconfiguration.json"
"aws-api/src/androidTest/res/raw/credentials.json"
"aws-api/src/androidTest/res/raw/amplifyconfigurationlazy.json"
# DataStore
"aws-datastore/src/androidTest/res/raw/amplifyconfiguration.json"
"aws-datastore/src/androidTest/res/raw/awsconfiguration.json"
"aws-datastore/src/androidTest/res/raw/credentials.json"
"aws-datastore/src/androidTest/res/raw/google_client_creds.json"
"aws-datastore/src/androidTest/res/raw/amplifyconfigurationupdated.json"
"aws-datastore/src/androidTest/res/raw/amplify_outputs.json"
# DataStore V2
"aws-datastore/src/androidTest/res/raw/amplifyconfiguration_v2.json"
# Predictions
"aws-predictions/src/androidTest/res/raw/amplifyconfiguration.json"
"aws-predictions/src/androidTest/res/raw/awsconfiguration.json"
# Storage
"aws-storage-s3/src/androidTest/res/raw/amplifyconfiguration.json"
"aws-storage-s3/src/androidTest/res/raw/awsconfiguration.json"
"aws-storage-s3/src/androidTest/res/raw/credentials.json"
"aws-storage-s3/src/androidTest/res/raw/amplify_outputs.json"
# Geo
"aws-geo-location/src/androidTest/res/raw/amplifyconfiguration.json"
"aws-geo-location/src/androidTest/res/raw/awsconfiguration.json"
"aws-geo-location/src/androidTest/res/raw/credentials.json"
"aws-geo-location/src/androidTest/res/raw/amplify_outputs.json"
# Maplibre Adapter
"maplibre-adapter/src/androidTest/res/raw/amplifyconfiguration.json"
"maplibre-adapter/src/androidTest/res/raw/awsconfiguration.json"
"maplibre-adapter/src/androidTest/res/raw/credentials.json"
# Auth
"aws-auth-cognito/src/androidTest/res/raw/amplifyconfiguration.json"
"aws-auth-cognito/src/androidTest/res/raw/amplifyconfiguration_totp.json"
"aws-auth-cognito/src/androidTest/res/raw/amplifyconfiguration_passwordless.json"
"aws-auth-cognito/src/androidTest/res/raw/awsconfiguration.json"
"aws-auth-cognito/src/androidTest/res/raw/credentials.json"
"aws-auth-cognito/src/androidTest/res/raw/amplify_outputs.json"
"aws-auth-cognito/src/androidTest/res/raw/amplify_outputs_email_or_totp_mfa.json"
)
# Set up output path
declare -r dest_dir=$HOME/.aws-amplify/amplify-android
mkdir -p "$dest_dir"
# Download remote files into a local directory outside of the project.
for config_file in ${config_files[@]}; do
aws s3 cp "s3://$config_bucket/$config_file" "$dest_dir/$config_file" &
done
wait
# Create a symlink for each configuration file.
for config_file in ${config_files[@]}; do
mkdir -p "$(dirname "$config_file")"
ln -s "$dest_dir/$config_file" "$config_file" &
done
wait