firebase / firebase/firebase-admin-java
Parse GOOGLE_APPLICATION_CREDENTIALS as JSON if it begins with '{'
- 主要言語
- Java
- スター
- 620
- フォーク
- 305
- 平均マージ
- 3時間 23分
- マージ済み PR(30日)
- 1
説明
**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)
}
```
コントリビューションガイド
調査の方向性
まず、GOOGLE_APPLICATION_CREDENTIALS がどこで読み取られ、Java SDK でサービスアカウントの認証情報がどこで読み込まれるかを特定します。既存のファイルパスのフローを追跡し、その後、'{' で始まる値が認証情報 JSON として扱われ、それ以外の値は引き続きファイルパスとして扱われることを確認します。認証情報ファイルをコミットせずに、両方の入力形式が機能すれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- java
- 領域
- authentication
- issue の種類
- 機能追加
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 45/100