chore: fix letta server file read issue (#685)

Co-authored-by: Shubham Naik <shub@memgpt.ai>
This commit is contained in:
Shubham Naik
2025-01-17 14:08:55 -08:00
committed by GitHub
parent 02cca70d78
commit 690cfd2452

View File

@@ -83,12 +83,16 @@ cors_origins = [
# read pg_uri from ~/.letta/pg_uri or set to none, this is to support Letta Desktop
default_pg_uri = None
try:
with open(Path.home() / ".letta/pg_uri", "r") as f:
default_pg_uri = f.read()
print("Read pg_uri from ~/.letta/pg_uri")
except FileNotFoundError:
pass
## check if --use-file-pg-uri is passed
import sys
if "--use-file-pg-uri" in sys.argv:
try:
with open(Path.home() / ".letta/pg_uri", "r") as f:
default_pg_uri = f.read()
print("Read pg_uri from ~/.letta/pg_uri")
except FileNotFoundError:
pass
class Settings(BaseSettings):