firebase / firebase/firebase-admin-java
Parse GOOGLE_APPLICATION_CREDENTIALS as JSON if it begins with '{'
- Lenguaje dominante
- Java
- Estrellas
- 620
- Forks
- 305
- Merge medio
- 3 h 23 min
- PR fusionados (30 d)
- 1
Descripción
**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)
}
```
Guía de contribución
Línea de trabajo
Comienza localizando dónde se lee GOOGLE_APPLICATION_CREDENTIALS y dónde se cargan las credenciales de cuenta de servicio en el Java SDK. Sigue el flujo existente de rutas de archivo y verifica después que los valores que comienzan por '{' se traten como JSON de credenciales, mientras que los demás valores sigan siendo rutas de archivo; se considera terminado cuando ambas formas de entrada funcionan sin hacer commit de un archivo de credenciales.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- java
- Área
- authentication
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 45/100