firebase / firebase/firebase-admin-java
Parse GOOGLE_APPLICATION_CREDENTIALS as JSON if it begins with '{'
- Vorherrschende Sprache
- Java
- Sterne
- 620
- Forks
- 305
- Ø Merge
- 3 Std. 23 Min.
- Gemergte PRs (30 T.)
- 1
Beschreibung
**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)
}
```
Beitragsleitfaden
Rechercherichtung
Beginne damit, zu ermitteln, wo GOOGLE_APPLICATION_CREDENTIALS gelesen wird und wo Dienstkonto-Credentials im Java SDK geladen werden. Verfolge den bestehenden Dateipfad-Ablauf und überprüfe dann, dass Werte, die mit '{' beginnen, als Credential-JSON behandelt werden, während andere Werte weiterhin Dateipfade bleiben; als erledigt gilt die Aufgabe, wenn beide Eingabeformen funktionieren, ohne eine Credential-Datei zu committen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- java
- Bereich
- authentication
- Issue-Typ
- Feature
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 45/100