Skip to content

Instantly share code, notes, and snippets.

@ts-ign0re
Last active September 28, 2021 04:46
Show Gist options
  • Save ts-ign0re/6c86297070517991e744c0eeada24c53 to your computer and use it in GitHub Desktop.
Save ts-ign0re/6c86297070517991e744c0eeada24c53 to your computer and use it in GitHub Desktop.
Write env variables from Appcenter with secrets into .env file
# Get all variables and write to .env
ENV_WHITELIST=${ENV_WHITELIST:-"^"}
printf "Creating an .env file with the following whitelist:\n"
printf "%s\n\n" $ENV_WHITELIST
set | egrep -e $ENV_WHITELIST | egrep -v "^_" | egrep -v "WHITELIST" > .env
printf "\n.env created with contents:\n"
cat .env
# copy firebase config files
if [[ "$APPCENTER_BRANCH" == "master" || "$APPCENTER_BRANCH" =~ 'release' ]];
then
cp -fr ./configuration/production/GoogleService-Info.plist ./ios
cp -fr ./configuration/production/google-services.json ./android/app
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment