2018-12-05 20:46:36 +03:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
# Creates an .env from ENV variables for use with react-native-config
|
2019-01-03 22:24:54 +03:00
|
|
|
|
2019-01-03 22:58:47 +03:00
|
|
|
GOOGLE_JSON_FILE=$APPCENTER_SOURCE_DIRECTORY/android/app/google-services.json
|
2019-01-03 22:38:13 +03:00
|
|
|
|
2019-01-03 22:51:09 +03:00
|
|
|
printf "%s\n\n" $APPCENTER_SOURCE_DIRECTORY
|
2019-01-03 22:24:54 +03:00
|
|
|
|
|
|
|
if [ -e "$GOOGLE_JSON_FILE" ]
|
|
|
|
then
|
|
|
|
echo "Updating Google Json"
|
|
|
|
echo "$GOOGLE_JSON" > $GOOGLE_JSON_FILE
|
|
|
|
sed -i -e 's/\\"/'\"'/g' $GOOGLE_JSON_FILE
|
|
|
|
|
|
|
|
echo "File content:"
|
|
|
|
cat $GOOGLE_JSON_FILE
|
|
|
|
fi
|
|
|
|
|
2019-01-03 22:51:09 +03:00
|
|
|
printf "google-services json file:\n"
|
|
|
|
|
|
|
|
cat $GOOGLE_JSON_FILE
|
|
|
|
|
2018-12-06 12:16:08 +03:00
|
|
|
printf "Old .env file:\n"
|
|
|
|
cat .env
|
|
|
|
printf "Started script:\n"
|
2019-01-08 15:08:39 +03:00
|
|
|
ENV_WHITELIST=${ENV_WHITELIST:-"/ACTIVITY|WEBSOCKET|BACKEND|API|TOKEN|PIN|URL/"}
|
2018-12-05 20:46:36 +03:00
|
|
|
printf "Creating an .env file with the following whitelist:\n"
|
|
|
|
printf "%s\n\n" $ENV_WHITELIST
|
2018-12-06 12:37:27 +03:00
|
|
|
set | egrep -e $ENV_WHITELIST | egrep -v "^_" | egrep -v "WHITELIST" | egrep -v "USER-DEFINED" > .env
|
2018-12-05 20:46:36 +03:00
|
|
|
printf "\n.env created with contents:\n"
|
2018-12-06 12:05:37 +03:00
|
|
|
cat .env
|
2019-01-03 22:24:54 +03:00
|
|
|
printf "\nEND OF .env\n"
|
|
|
|
|