google-services.json via environmental variable

1,396 views
Skip to first unread message

Moshe Brevda

unread,
Dec 30, 2016, 10:53:17 AM12/30/16
to Firebase Google Group
Hi -

I would prefer to keep my configs in the environment and not in the scm. I was wondering if it was possible to load the contents of google-services.json into an env var and reference it that way?

Thanks!

Doug Stevenson

unread,
Dec 30, 2016, 5:44:44 PM12/30/16
to Firebase Google Group
Moshe,

It's normally recommended not to check google-services.json into source control, unless you know that's secure for your purposes.  You can instead provide the file at build time by creating or copying it into place using a script or gradle task that you write yourself.

There's no existing tools provided by Google that copy things from env vars, but that's something you could do yourself with your own plugin, as long as it injects that same Android resources that the google services plugin adds to your project.  The plugin has its own documentation here.

You could also get the values into your app some other way that's convenient for you, then pull them out at runtime and initialize Firebase using your own call to FirebaseApp.initialzeApp().  In that case, you might also want to disable the FirebaseInitProvider that performs the default init using the values provided by the plugin.

Doug

Kato Richardson

unread,
Jan 12, 2017, 1:58:00 PM1/12/17
to Firebase Google Group
Note that there's also an example of passing an object, rather than a file path, into initializeApp() in the admin guide, here.

☼, Kato

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-talk+unsubscribe@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/13f6704e-4ed8-48de-9a85-4b11f895fe77%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--

Kato Richardson | Developer Programs Eng | kato...@google.com | 775-235-8398

Reply all
Reply to author
Forward
0 new messages