feat(config): Add refresh_token_expire_days setting
This commit is contained in:
@@ -37,6 +37,7 @@ class Settings(BaseSettings):
|
||||
secret_key: str = Field(default="change-me-in-production", alias="SECRET_KEY")
|
||||
algorithm: str = Field(default="HS256", alias="ALGORITHM")
|
||||
access_token_expire_minutes: int = Field(default=30, alias="ACCESS_TOKEN_EXPIRE_MINUTES")
|
||||
refresh_token_expire_days: int = Field(default=7, alias="REFRESH_TOKEN_EXPIRE_DAYS")
|
||||
|
||||
# OIDC Configuration
|
||||
oidc_client_id: Optional[str] = Field(default=None, alias="OIDC_CLIENT_ID")
|
||||
|
||||
@@ -43,3 +43,14 @@ def test_oidc_settings(monkeypatch):
|
||||
assert settings.oidc_client_id == "test_client_id"
|
||||
assert settings.oidc_client_secret == "test_client_secret"
|
||||
assert settings.oidc_server_metadata_url == "https://test.server/.well-known/openid-configuration"
|
||||
|
||||
def test_refresh_token_settings():
|
||||
"""Test that refresh token settings are loaded correctly."""
|
||||
settings = Settings()
|
||||
assert settings.refresh_token_expire_days == 7
|
||||
|
||||
def test_refresh_token_env_override(monkeypatch):
|
||||
"""Test that refresh token settings can be overridden by env vars."""
|
||||
monkeypatch.setenv("REFRESH_TOKEN_EXPIRE_DAYS", "30")
|
||||
settings = Settings()
|
||||
assert settings.refresh_token_expire_days == 30
|
||||
|
||||
Reference in New Issue
Block a user