mirror of
https://github.com/maxdorninger/MediaManager.git
synced 2026-04-19 11:54:09 +02:00
- Add default instances to all nested config classes (TorrentConfig, NotificationConfig, IndexerConfig, MetadataProviderConfig, AuthConfig) - Add default values to AllEncompassingConfig fields to prevent validation errors during testing - Update GitHub workflow to copy config.example.toml before running tests - Ensures tests can run without requiring complete configuration files while maintaining production functionality Fixes test collection errors where pydantic validation failed due to missing required config sections.
26 lines
666 B
Python
26 lines
666 B
Python
from pydantic_settings import BaseSettings
|
|
from pydantic import Field
|
|
import secrets
|
|
|
|
|
|
class OpenIdConfig(BaseSettings):
|
|
client_id: str = ""
|
|
client_secret: str = ""
|
|
configuration_endpoint: str = ""
|
|
name: str = "OpenID"
|
|
enabled: bool = False
|
|
|
|
|
|
class AuthConfig(BaseSettings):
|
|
# to get a signing key run:
|
|
# openssl rand -hex 32
|
|
token_secret: str = Field(default_factory=secrets.token_hex)
|
|
session_lifetime: int = 60 * 60 * 24
|
|
admin_emails: list[str] = []
|
|
email_password_resets: bool = False
|
|
openid_connect: OpenIdConfig = OpenIdConfig()
|
|
|
|
@property
|
|
def jwt_signing_key(self):
|
|
return self._jwt_signing_key
|