Skip to content

Commit 3073bc8

Browse files
Add JWT_SIGNING_KEY setting and use it
Expose JWT_SIGNING_KEY from config.settings (read from ENV) and update src/app/container.py to import and check that setting instead of calling os.getenv directly. Remove the now-unused os import. This centralizes environment access for the JWT signing key and ensures RSA keypair generation is skipped when JWT_SIGNING_KEY is provided (and IBM auth is disabled).
1 parent 2d4ce36 commit 3073bc8

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

src/app/container.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@
33
Returns a dict consumed by routes (via FastAPI Depends) and the lifespan hook.
44
"""
55

6-
import os
7-
86
from api.connector_router import ConnectorRouter
97
from config.settings import (
108
INGESTION_TIMEOUT,
9+
JWT_SIGNING_KEY,
1110
SESSION_SECRET,
1211
clients,
1312
config_manager,
@@ -47,7 +46,7 @@ async def initialize_services():
4746

4847
# Generate JWT keys if they don't exist, a JWT signing key isn't specified,
4948
# and IBM auth is not enabled (IBM mode delegates all auth to Traefik)
50-
if not os.getenv("JWT_SIGNING_KEY") and not IBM_AUTH_ENABLED:
49+
if not JWT_SIGNING_KEY and not IBM_AUTH_ENABLED:
5150
generate_jwt_keys()
5251

5352
# Initialize clients (now async to generate Langflow API key)

src/config/settings.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@
5757
# Allow explicit key via environment; generation will be skipped if set
5858
LANGFLOW_KEY = os.getenv("LANGFLOW_KEY")
5959
SESSION_SECRET = os.getenv("SESSION_SECRET", "your-secret-key-change-in-production")
60+
# Optional explicit JWT signing key. When set (and IBM auth is off),
61+
# RSA keypair generation is skipped. Read here so callers don't poke
62+
# os.environ directly.
63+
JWT_SIGNING_KEY = os.getenv("JWT_SIGNING_KEY")
6064
GOOGLE_OAUTH_CLIENT_ID = os.getenv("GOOGLE_OAUTH_CLIENT_ID")
6165
GOOGLE_OAUTH_CLIENT_SECRET = os.getenv("GOOGLE_OAUTH_CLIENT_SECRET")
6266

0 commit comments

Comments
 (0)