firebase / firebase/firebase-admin-java
Parse GOOGLE_APPLICATION_CREDENTIALS as JSON if it begins with '{'
- Linguagem predominante
- Java
- Estrelas
- 620
- Forks
- 305
- Merge médio
- 3h 23min
- PRs com merge (30d)
- 1
Descrição
**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)
}
```
Guia de contribuição
Direção de pesquisa
Comece localizando onde GOOGLE_APPLICATION_CREDENTIALS é lido e onde as credenciais da conta de serviço são carregadas no Java SDK. Rastreie o fluxo existente de caminhos de arquivo e, em seguida, verifique se os valores que começam com '{' são tratados como JSON de credenciais, enquanto os outros valores continuam sendo caminhos de arquivo; está concluído quando ambas as formas de entrada funcionarem sem fazer commit de um arquivo de credenciais.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- java
- Domínio
- authentication
- Tipo de issue
- Funcionalidade
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Status de atividade
- Estagnada
- Clareza
- Razoavelmente clara
- Facilidade para iniciantes
- 45/100