Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: allow setting pass for server --secure #2132

Merged
merged 2 commits into from
Dec 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading