Hi! I was wondering how one would go about settings this up with different GoogleService-info.plist files? I have two configurations (Staging & Production), and for these I want the different plist files.
According to this it's absolutely possible but I don't know how to do this with your wrapper.
Thanks in advance
The may I do it is create multiple schemes and buildTypes on ios/Android. Then as a build step copy over the right GoogleService-info.plist file.
Each scheme has a custom property that specifies the filename
Build Phases then has a script to copy the right one over
Here is the code for the build script:
cp -r "${PROJECT_DIR}/thriller/SupportingFiles/${FIREBASE_CONFIG_FILE_PREFIX}-GoogleService-Info.plist" "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/GoogleService-Info.plist"
echo "${FIREBASE_CONFIG_FILE_PREFIX} Firebase plist copied"
For android its as easy as just create directories inside android/app/src/ and build script automatically picks up the right file. The debug json is android/app and is default.
This is the approach we use too. I'll leave this issue open so we can add some information to the docs.
New docs are at https://github.com/invertase/react-native-firebase-docs - will need adding there, not sure under what section yet though.
Could you guys please create a step-by-step setup guide for this in the docs? It would be really helpful for most of us, since I haven't found any guide like this online. Thank you!
I created a solution that works with App Center:
https://medium.com/@egunsoma/firebase-environments-with-react-native-dev-staging-prod-3832d7d22a80
Hi guys, thanks for the help on this... I have doubts about how to do this correctly.
But why not use different targets as specified in the firebase documentation? Where in each of the targets you can associate a different GoogleService-Info.plist
file
@pmarconi : Those names you see in the first image are targets.
You can definitely do what they mention, but its much more easier if you want to build a target pointing to a different environment. Also that doc didn't exists when this issue was created.
Thanks all for the solutions on this and the write-ups. Lets move this discussion over to https://github.com/invertase/react-native-firebase-docs/issues/76 which is a duplicate of this.
Any chance of reviving as issue #76 is a broken link?
@krewllobster link is fine now, sorry about that. On a side note this functionality will be coming in a CLI later in the year.
Hey there,
I'm really struggling to setup dev and prod environments, and build the app accordingly,
any news about this?
@fhuel there are lots of ways to do it. Depends on your desires. Here is a big copy/splat from the Discord where I answered this recently.
I am unsure. I personally wanted fewer steps, and I felt having a sort of "render" phase prior to the real build (the file copy style) was another moving part and some script to maintain, while Xcode provided me the way to configure and declare the targets and plist files etc, so I chose that. But I'll be the first to rant about how terrible Xcode's configuration system is - almost bad enough to make me want to do a pre-render (which isn't too hard to reason about) vs have it in Xcode. In the end I did it in Xcode and it's worked well so I just keep using it. :slight_smile:
GazzaHazzaLast Tuesday at 10:17 AM
Thanks for letting me know! if you have any good material on this subject that helped you could you pass it my way? :thumbsup: Thanks again
MikeHardyLast Tuesday at 10:24 AM
then on the android side I use flavors - I followed a tutorial that I have since forgotten unfortunately
here is an example of the "pre-render" style https://medium.com/@egunsoma/firebase-environments-with-react-native-dev-staging-prod-3832d7d22a80
here's one that does pre-render but as a build phase https://medium.com/bam-tech/setup-firebase-on-ios-android-with-multiple-environments-ad4e7ef35607
here's the different targets style https://gist.github.com/jacks205/45b2721bf2a2b912b1c130aef2572820 - mine works a bit like this
MikeHardyLast Tuesday at 10:30 AM
I misspoke - they are not targets, they are schemes - this example is from flutter but maps very closely to how I did it on both sides https://medium.com/@matt.goodson.business/separating-build-environment-configurations-in-flutter-with-firebase-doing-it-the-right-way-c72c3ad3621f
then I just choose which scheme to build. lots of ways to do it as you can see :-). good luck
```
Hey @mikehardy , thank you!
Per the CodePush multi-deployment docs, the multi-deployment is only available for React. any ideas how others do it for Angular 8 and iOS ?
Most helpful comment
The may I do it is create multiple schemes and buildTypes on ios/Android. Then as a build step copy over the right GoogleService-info.plist file.
Each scheme has a custom property that specifies the filename
Build Phases then has a script to copy the right one over
Here is the code for the build script:
For android its as easy as just create directories inside android/app/src/ and build script automatically picks up the right file. The debug json is android/app and is default.