Skip to content

Commit

Permalink
fix: allow setting pass for server --secure (letta-ai#2132)
Browse files Browse the repository at this point in the history
  • Loading branch information
cpacker authored Dec 2, 2024
1 parent 7765cad commit aa36ee2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions letta/server/rest_api/app.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import json
import logging
import os
import sys
from pathlib import Path
from typing import Optional
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -132,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)

Expand Down

0 comments on commit aa36ee2

Please sign in to comment.