firebase / firebase/firebase-admin-java
Parse GOOGLE_APPLICATION_CREDENTIALS as JSON if it begins with '{'
- Langage dominant
- Java
- Étoiles
- 620
- Forks
- 305
- Merge moyen
- 3 h 23 min
- PR mergées (30 j)
- 1
Description
**Is your feature request related to a problem? Please describe.**
I do not want to commit my credentials file to github, and when running my app inside another enviroment such as Heroku, i run into the trouble because even though i can specify ENV variables i must provide a file path for GOOGLE_APPLICATION_CREDENTIALS, which is inconvenient because im using git to deploy to heroku
**Describe the solution you'd like**
Parse GOOGLE_APPLICATION_CREDENTIALS as JSON if it begins with '{', otherwise assume is a file path.
**Describe alternatives you've considered**
Adding additional code that reads an env var which contains the credential json, this is inconvenient because i will need to copy and paste this code for all my projects that use firebase admin
```
fun createApp(): FirebaseApp {
val credentials = System.getenv("FIREBASE_CONFIG")
.byteInputStream()
.use { stream -> ServiceAccountCredentials.fromStream(stream) }
val config = FirebaseOptions.builder()
.setCredentials(credentials)
.build()
return FirebaseApp.initializeApp(config)
}
```
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Commencez par localiser où GOOGLE_APPLICATION_CREDENTIALS est lu et où les identifiants de compte de service sont chargés dans le Java SDK. Suivez le flux existant des chemins de fichiers, puis vérifiez que les valeurs commençant par '{' sont traitées comme du JSON d’identifiants, tandis que les autres valeurs restent des chemins de fichiers ; c’est terminé lorsque les deux formes d’entrée fonctionnent sans committer de fichier d’identifiants.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- java
- Domaine
- authentication
- Type d'issue
- Fonctionnalité
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 45/100