Base Settings Models¶
Defines all application settings models (dataclasses) and the central function for loading configuration.
—
Configuration Loader¶
—
Settings Container (Settings)¶
- class Settings(app: app.config.base.AppSettings = <factory>, log: app.config.base.LogSettings = <factory>, db: app.config.base.DatabaseSettings = <factory>, jwt: app.config.base.JWTSettings = <factory>, redis: app.config.base.RedisSettings = <factory>)[source]¶
Bases:
objectContainer class holding all application configuration settings.
- app¶
Application-level settings.
- Type:
- log¶
Logging configuration.
- Type:
- db¶
Database connection and pool settings.
- Type:
- jwt¶
JWT token configuration.
- Type:
- redis¶
Redis client and connection settings.
- Type:
—
Application Settings (AppSettings)¶
- class AppSettings(DEBUG: bool = <factory>, NAME: str = 'IronTrack', ENVIRONMENT: str = <factory>, API_V1_URL_PREFIX: str = '/api/v1', CDN_IMAGES_DEFAULT_URL: str = <factory>)[source]¶
Bases:
objectApplication configuration.
—
Logger Settings (LogSettings)¶
- class LogSettings(LEVEL: int = <factory>, STRUCTLOG_LEVEL: int = 20, ASGI_ACCESS_LEVEL: int = <factory>, ASGI_ERROR_LEVEL: int = <factory>, MIDDLEWARE_LOG_LEVEL: int = 20, SQLALCHEMY_LEVEL: int = <factory>)[source]¶
Bases:
objectLogger configuration.
- STRUCTLOG_LEVEL: int = 20¶
Fixed structlog filtering level.
Must be 20 (INFO) to ensure middleware logs are not dropped before reaching the standard logging library.
—
Database Settings (DatabaseSettings)¶
- class DatabaseSettings(POSTGRES_HOST: str = <factory>, POSTGRES_PORT: int = <factory>, POSTGRES_USER: str = <factory>, POSTGRES_PASSWORD: str = <factory>, POSTGRES_DB: str = <factory>, URL: str | None = <factory>, ECHO: bool = <factory>, ECHO_POOL: bool = <factory>, POOL_MAX_OVERFLOW: int = <factory>, POOL_SIZE: int = <factory>, POOL_TIMEOUT: int = <factory>, POOL_RECYCLE: int = <factory>, POOL_PRE_PING: bool = <factory>, POOL_DISABLED: bool = <factory>, MIGRATION_CONFIG: str = <factory>, MIGRATION_PATH: str = <factory>, MIGRATION_DDL_VERSION_TABLE: str = 'ddl_version', FIXTURE_PATH: str = <factory>, PGBOUNCER_ENABLED: bool = <factory>)[source]¶
Bases:
objectDatabase configuration.
- MIGRATION_DDL_VERSION_TABLE: str = 'ddl_version'¶
The name to use for the alembic versions table name.
- get_connection_url() str[source]¶
Construct the full PostgreSQL connection URL.
The method prioritizes the explicit URL attribute if it is set.
- Returns:
The full connection URL string.
- Return type:
- property engine: AsyncEngine¶
The SQLAlchemy async engine instance for database operations.
—
JWT Settings (JWTSettings)¶
- class JWTSettings(ALGORITHM: str = 'Ed25519', JWT_PRIVATE_KEY: str | None = <factory>, ACCESS_TOKEN_EXPIRE_MINUTES: int = <factory>, REFRESH_TOKEN_EXPIRE_DAYS: int = <factory>)[source]¶
Bases:
objectJWT configuration.
- JWT_PRIVATE_KEY: str | None¶
The Ed25519 private key in JWK (JSON Web Key) format.
This key is used for both signing and verifying tokens using the Ed25519 algorithm as specified in RFC 9864. The string must be a valid JSON containing ‘kty’, ‘crv’, ‘x’, and ‘d’ parameters.
Example
‘{“kty”:”OKP”,”crv”:”Ed25519”,”x”:”…”,”d”:”…”}’
- property key_object: OKPKey¶
The initialized Ed25519 key object for signing and verification.
Parses the JWT_PRIVATE_KEY from environment variables and returns a ready-to-use OKPKey instance.
- Returns:
The cryptographic key object for Ed25519 operations.
- Return type:
OKPKey
- Raises:
JWTKeyConfigError – If the key is missing, not a valid JSON, or lacks required JWK parameters (kty, crv, x, d).
—