From a88adb5bc493d96c9c26c3bc65bc46dfd7a6d441 Mon Sep 17 00:00:00 2001 From: cpacker Date: Sun, 1 Dec 2024 21:28:12 -0800 Subject: [PATCH 1/2] fix: allow passing a custom password when using --secure --- letta/server/rest_api/app.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/letta/server/rest_api/app.py b/letta/server/rest_api/app.py index bef68b71fa..321f9639a0 100644 --- a/letta/server/rest_api/app.py +++ b/letta/server/rest_api/app.py @@ -1,5 +1,6 @@ import json import logging +import os import sys from pathlib import Path from typing import Optional @@ -103,7 +104,7 @@ def generate_password(): return secrets.token_urlsafe(16) -random_password = generate_password() +random_password = os.getenv("LETTA_SERVER_PASSWORD") or generate_password() class CheckPasswordMiddleware(BaseHTTPMiddleware): From 434bd7ffb858e808da0bed3c325b4c0736e3ae04 Mon Sep 17 00:00:00 2001 From: cpacker Date: Sun, 1 Dec 2024 21:34:59 -0800 Subject: [PATCH 2/2] fix: allow setting --ade and --secure via env vars --- letta/server/rest_api/app.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/letta/server/rest_api/app.py b/letta/server/rest_api/app.py index 321f9639a0..c8f2cdf044 100644 --- a/letta/server/rest_api/app.py +++ b/letta/server/rest_api/app.py @@ -133,11 +133,11 @@ def create_application() -> "FastAPI": debug=True, ) - if "--ade" in sys.argv: + if (os.getenv("LETTA_SERVER_ADE") == "true") or "--ade" in sys.argv: settings.cors_origins.append("https://app.letta.com") print(f"▶ View using ADE at: https://app.letta.com/development-servers/local/dashboard") - if "--secure" in sys.argv: + if (os.getenv("LETTA_SERVER_SECURE") == "true") or "--secure" in sys.argv: print(f"▶ Using secure mode with password: {random_password}") app.add_middleware(CheckPasswordMiddleware)