chore: auto-commit 2026-03-16 16:55
This commit is contained in:
parent
37c0882d2d
commit
b2f2617348
2 changed files with 30 additions and 1 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
from pydantic_settings import BaseSettings
|
from pydantic_settings import BaseSettings
|
||||||
from typing import Optional, List
|
from typing import Optional, List
|
||||||
from pydantic import field_validator, ConfigDict
|
from pydantic import field_validator, ConfigDict
|
||||||
|
import json
|
||||||
|
|
||||||
|
|
||||||
class Settings(BaseSettings):
|
class Settings(BaseSettings):
|
||||||
|
|
@ -46,6 +47,31 @@ class Settings(BaseSettings):
|
||||||
)
|
)
|
||||||
return v
|
return v
|
||||||
|
|
||||||
|
@field_validator('oauth2_supported_scopes', 'oauth2_supported_grant_types', mode='before')
|
||||||
|
@classmethod
|
||||||
|
def parse_list_from_string(cls, v):
|
||||||
|
"""Parse list from either JSON string or space/comma-separated string."""
|
||||||
|
if isinstance(v, list):
|
||||||
|
return v
|
||||||
|
if isinstance(v, str):
|
||||||
|
# Try to parse as JSON first
|
||||||
|
try:
|
||||||
|
return json.loads(v)
|
||||||
|
except json.JSONDecodeError:
|
||||||
|
# If not JSON, try comma-separated or space-separated
|
||||||
|
# Remove quotes and split by commas or spaces
|
||||||
|
v = v.strip()
|
||||||
|
if ',' in v:
|
||||||
|
# Comma-separated
|
||||||
|
items = [item.strip().strip('"\'') for item in v.split(',')]
|
||||||
|
else:
|
||||||
|
# Space-separated
|
||||||
|
items = [item.strip().strip('"\'') for item in v.split()]
|
||||||
|
# Filter out empty strings
|
||||||
|
return [item for item in items if item]
|
||||||
|
# Return as-is for other types (should be list)
|
||||||
|
return v
|
||||||
|
|
||||||
model_config = ConfigDict(env_file=".env")
|
model_config = ConfigDict(env_file=".env")
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -217,7 +217,10 @@ LOG_LEVEL=INFO
|
||||||
OAUTH2_ISSUER=http://localhost:${PORT}
|
OAUTH2_ISSUER=http://localhost:${PORT}
|
||||||
OAUTH2_ACCESS_TOKEN_EXPIRE_MINUTES=30
|
OAUTH2_ACCESS_TOKEN_EXPIRE_MINUTES=30
|
||||||
OAUTH2_REFRESH_TOKEN_EXPIRE_DAYS=7
|
OAUTH2_REFRESH_TOKEN_EXPIRE_DAYS=7
|
||||||
OAUTH2_SUPPORTED_SCOPES=openid profile email api:read api:write
|
OAUTH2_AUTHORIZATION_CODE_EXPIRE_MINUTES=10
|
||||||
|
OAUTH2_SUPPORTED_GRANT_TYPES=["authorization_code", "client_credentials", "refresh_token"]
|
||||||
|
OAUTH2_SUPPORTED_SCOPES=["openid", "profile", "email", "api:read", "api:write"]
|
||||||
|
OAUTH2_PKCE_REQUIRED=false
|
||||||
|
|
||||||
# Server Settings
|
# Server Settings
|
||||||
HOST=0.0.0.0
|
HOST=0.0.0.0
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue