Skip to content

Commit ac18e56

Browse files
committed
.
1 parent 6c1b48a commit ac18e56

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,3 +134,6 @@ __pycache__/
134134
run_act_test.bat
135135
.DS_Store
136136
*.py~
137+
138+
# Streamlit secrets
139+
.streamlit/secrets.toml

streamlit_app.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,11 @@ def _load_api_key() -> Optional[str]:
4747
# 2. Environment Variable
4848
api_key = os.environ.get("APIKEY")
4949
if api_key:
50+
print("DEBUG: Found APIKEY in os.environ")
5051
return api_key
5152

5253
cwd = os.getcwd()
54+
print(f"DEBUG: CWD is {cwd}")
5355

5456
# 3. api_key file
5557
api_key_path = os.path.join(cwd, "api_key")
@@ -59,15 +61,21 @@ def _load_api_key() -> Optional[str]:
5961

6062
# 4. .env file
6163
env_path = os.path.join(cwd, ".env")
64+
print(f"DEBUG: Checking .env at {env_path}")
6265
if os.path.isfile(env_path):
66+
print("DEBUG: .env file exists")
6367
with open(env_path, "r") as f:
6468
for line in f:
6569
stripped = line.strip()
6670
if not stripped or stripped.startswith("#") or "=" not in stripped:
6771
continue
6872
key, value = stripped.split("=", 1)
73+
# print(f"DEBUG: Seen key: {key}")
6974
if key.strip() == "APIKEY" and value.strip():
75+
print("DEBUG: Found APIKEY in .env")
7076
return value.strip()
77+
else:
78+
print("DEBUG: .env file NOT found")
7179
return None
7280

7381

0 commit comments

Comments
 (0)