firebase / firebase/firebase-admin-java
Parse GOOGLE_APPLICATION_CREDENTIALS as JSON if it begins with '{'
- 主要語言
- Java
- 星號
- 620
- 分支
- 305
- 平均合併
- 3 小時 23 分鐘
- 30 天內合併 PR
- 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