MukeshKapoor25 commited on
Commit
274a33b
·
1 Parent(s): 206d2a8

refactor(config): improve jwt config flexibility with fallback values

Browse files

Add fallback environment variables for JWT configuration to maintain compatibility with UMS while preferring AMS-specific values. This makes the configuration more resilient when migrating between systems.

Files changed (1) hide show
  1. app/core/config.py +6 -3
app/core/config.py CHANGED
@@ -68,9 +68,12 @@ class Settings:
68
  APPOINTMENTS_KEY_PREFIX: str = os.getenv("APPOINTMENTS_KEY_PREFIX", "appointments")
69
 
70
  # JWT settings
71
- JWT_SECRET_KEY: str = os.getenv("JWT_SECRET_KEY")
72
- JWT_ALGORITHM: str = os.getenv("JWT_ALGORITHM", "HS256")
73
- JWT_ACCESS_TOKEN_EXPIRE_MINUTES: int = int(os.getenv("JWT_ACCESS_TOKEN_EXPIRE_MINUTES", "30"))
 
 
 
74
 
75
  # Security settings
76
  # Include Hugging Face Spaces by default to avoid 400s behind their proxy.
 
68
  APPOINTMENTS_KEY_PREFIX: str = os.getenv("APPOINTMENTS_KEY_PREFIX", "appointments")
69
 
70
  # JWT settings
71
+ # Prefer AMS-specific envs; gracefully fall back to UMS-compatible names
72
+ JWT_SECRET_KEY: str = os.getenv("JWT_SECRET_KEY") or os.getenv("SECRET_KEY")
73
+ JWT_ALGORITHM: str = os.getenv("JWT_ALGORITHM") or os.getenv("ALGORITHM", "HS256")
74
+ JWT_ACCESS_TOKEN_EXPIRE_MINUTES: int = int(
75
+ os.getenv("JWT_ACCESS_TOKEN_EXPIRE_MINUTES", os.getenv("ACCESS_TOKEN_EXPIRE_MINUTES", "30"))
76
+ )
77
 
78
  # Security settings
79
  # Include Hugging Face Spaces by default to avoid 400s behind their proxy.