kreait / laravel-firebase

A Laravel package for the Firebase PHP Admin SDK
https://github.com/kreait/firebase-php
MIT License
1.09k stars 174 forks source link

Add option to configure credentials from array #14

Closed leoneparise closed 4 years ago

leoneparise commented 4 years ago

First of all, thank you for this amazing library!

I'm running my application in Laravel Vapor and the app doesn't have access to the filesystem. I have to configure the application only using environment variables. This PR address this problem and add an array option.

jeromegamez commented 4 years ago

The file option is misleading, but you can use a JSON String containing the Service Account credentials instead of providing the path to a file.

I‘m using this approach for the integration tests using GitHub actions for the SDK itself - would that be an option for you as well?

leoneparise commented 4 years ago

I made it working after some trials:

  1. The credentials file must have only one line and no spaces between key and values.
  2. Replace all \n to \r\n inside the key.
jeromegamez commented 4 years ago

You beat me to it, that‘s how I solved it with GitHub actions as well ^^. I will add this to the docs to make it easier for others to find. Thank you!