Open NachtRitter opened 7 years ago
@pedro do you have any solutions for my case?
@NachtRitter I achieved similar thing using this over-complicated method, but didn't find anything easier, because BuildDotenvConfig.ruby
just deletes /tmp/envfile
after it's processed.
use export
in .env.* files so you can use the values as environment variables in your build script:
export ABC=1
backup env file name in scheme pre-action script (reading $ENVFILE
in the build script didn't work for me for some reason)
if [ -n /tmp/envfile ]
then
cp -f /tmp/envfile /tmp/my_envfile
else
echo ".env" > /tmp/my_envfile
fi
run the envfile in build script to get your variables set as environment variables so as you can use them in the script
envfile=$(< /tmp/my_envfile)
source $PROJECT_DIR/../$envfile
echo $ABC
hi @NachtRitter , my pr #349 allows reading values from env file in Build settings. please give it a try, thanks
@maxkomarychev Thanks, however I'm not working currently with React Native projects. So maybe someone else will check it
I want to add Crashlytics to my project. One of the steps is "Add a Run Script Build Phase". I should add line:
"${PODS_ROOT}/Fabric/run" <FABRIC_API_KEY> <BUILD_SECRET>
So, FABRIC_API_KEY and BUILD_SECRET I'd like to configure via .env-file (to set up different Crashlytics-accounts for different environments).In project.pbxproj it looks like:
@GantMan , I'm not very familiar with XCode, because it's my first RN-project.
Also I should add to Info.plist file. According to react-native-config documentation, I have access to variables from my .env-file in Info.plist. Am I right?