Spaces:
Running
Running
update firebase piece to read key json from secrets
Browse files- .gitignore +4 -1
- src/services/firebase.py +4 -1
.gitignore
CHANGED
@@ -39,4 +39,7 @@ ENV/
|
|
39 |
|
40 |
# Logs
|
41 |
*.log
|
42 |
-
|
|
|
|
|
|
|
|
39 |
|
40 |
# Logs
|
41 |
*.log
|
42 |
+
*firebase*.json
|
43 |
+
|
44 |
+
# Streamlit secrets
|
45 |
+
.streamlit/secrets.toml
|
src/services/firebase.py
CHANGED
@@ -3,13 +3,16 @@ from firebase_admin import credentials, firestore
|
|
3 |
from typing import List, Dict, Optional
|
4 |
import pandas as pd
|
5 |
import streamlit as st
|
|
|
6 |
|
7 |
def initialize_firebase():
|
8 |
"""Initialize Firebase with credentials"""
|
9 |
try:
|
10 |
firebase_admin.get_app()
|
11 |
except ValueError:
|
12 |
-
|
|
|
|
|
13 |
firebase_admin.initialize_app(cred)
|
14 |
return firestore.client()
|
15 |
|
|
|
3 |
from typing import List, Dict, Optional
|
4 |
import pandas as pd
|
5 |
import streamlit as st
|
6 |
+
import json
|
7 |
|
8 |
def initialize_firebase():
|
9 |
"""Initialize Firebase with credentials"""
|
10 |
try:
|
11 |
firebase_admin.get_app()
|
12 |
except ValueError:
|
13 |
+
# Get the entire Firebase credentials JSON from secrets
|
14 |
+
firebase_creds = json.loads(st.secrets["FIREBASE_CREDENTIALS"])
|
15 |
+
cred = credentials.Certificate(firebase_creds)
|
16 |
firebase_admin.initialize_app(cred)
|
17 |
return firestore.client()
|
18 |
|