derp.config – Configuration

Central configuration for Derp.

exception derp.config.ConfigError[source]

Bases: Exception

Configuration error.

class derp.config.DatabaseConfig[source]

Bases: _StrictModel

Database configuration.

db_url: str
replica_url: str | None
schema_path: str
migrations_dir: str
introspect_schemas: Sequence[str]
introspect_exclude_tables: Sequence[str]
ignore_rls: bool
pool_min_size: int
pool_max_size: int
statement_cache_size: int
replica_pool_min_size: int | None
replica_pool_max_size: int | None
replica_statement_cache_size: int | None
replica_max_lag_bytes: int
replica_write_fence_seconds: float
replica_lag_check_interval_seconds: float
model_config = {'extra': 'forbid'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class derp.config.EmailConfig[source]

Bases: _StrictModel

Configuration for email sending via SMTP.

site_name: str
site_url: str
from_email: str
smtp_host: str
smtp_port: int
smtp_user: str
smtp_password: str
templates_dir: str | None
use_tls: bool
start_tls: bool
model_config = {'extra': 'forbid'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class derp.config.JWTConfig[source]

Bases: _StrictModel

Configuration for JWT tokens.

secret: str
algorithm: str
access_token_expire_minutes: int
refresh_token_expire_days: int
issuer: str | None
audience: str | None
model_config = {'extra': 'forbid'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class derp.config.PasswordConfig[source]

Bases: _StrictModel

Configuration for password validation.

min_length: int
max_length: int
require_uppercase: bool
require_lowercase: bool
require_digit: bool
require_special: bool
model_config = {'extra': 'forbid'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class derp.config.GoogleOAuthConfig[source]

Bases: _StrictModel

Configuration for Google OAuth.

client_id: str
client_secret: str
redirect_uri: str
scopes: Sequence[str]
model_config = {'extra': 'forbid'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class derp.config.GitHubOAuthConfig[source]

Bases: _StrictModel

Configuration for GitHub OAuth.

client_id: str
client_secret: str
redirect_uri: str
scopes: Sequence[str]
model_config = {'extra': 'forbid'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class derp.config.NativeAuthConfig[source]

Bases: _StrictModel

Configuration for native authentication (email/password, magic link, OAuth).

jwt: JWTConfig
password: PasswordConfig
google_oauth: GoogleOAuthConfig | None
github_oauth: GitHubOAuthConfig | None
enable_signup: bool
enable_confirmation: bool
recovery_token_expire_minutes: int
confirmation_token_expire_hours: int
session_expire_days: int
use_kv_cache: bool
cache_prefix: str
cache_session_ttl_seconds: int
cache_user_ttl_seconds: int
model_config = {'extra': 'forbid'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class derp.config.SupabaseConfig[source]

Bases: _StrictModel

Configuration for Supabase GoTrue authentication.

url: str
anon_key: str
service_role_key: str
jwt_secret: str
redirect_uri: str | None
model_config = {'extra': 'forbid'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class derp.config.WorkOSConfig[source]

Bases: _StrictModel

Configuration for WorkOS authentication.

api_key: str
client_id: str
redirect_uri: str | None
model_config = {'extra': 'forbid'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class derp.config.AuthConfig[source]

Bases: _StrictModel

Auth configuration — exactly one backend must be set.

native: NativeAuthConfig | None
supabase: SupabaseConfig | None
workos: WorkOSConfig | None
model_config = {'extra': 'forbid'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class derp.config.StorageConfig[source]

Bases: _StrictModel

Storage configuration.

endpoint_url: str | None
public_urls: dict[str, str]
service_name: str
access_key_id: str | None
secret_access_key: str | None
session_token: str | None
region: str
use_ssl: bool
verify: bool | str
model_config = {'extra': 'forbid'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class derp.config.PaymentsConfig[source]

Bases: _StrictModel

Payments configuration.

api_key: str
webhook_secret: str | None
max_network_retries: int
timeout_seconds: float
model_config = {'extra': 'forbid'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class derp.config.ValkeyMode[source]

Bases: StrEnum

Valkey deployment mode.

STANDALONE = 'standalone'
CLUSTER = 'cluster'
__new__(value)
class derp.config.ValkeyConfig[source]

Bases: _StrictModel

Configuration for Valkey GLIDE connections.

addresses: Sequence[tuple[str, int]]
username: str | None
password: str | None
use_tls: bool
mode: ValkeyMode
model_config = {'extra': 'forbid'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class derp.config.KVConfig[source]

Bases: _StrictModel

KV configuration.

valkey: ValkeyConfig | None
model_config = {'extra': 'forbid'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class derp.config.CeleryConfig[source]

Bases: _StrictModel

Configuration for Celery task queue.

broker_url: str
result_backend: str | None
task_serializer: str
result_serializer: str
task_default_queue: str
model_config = {'extra': 'forbid'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class derp.config.VercelQueueConfig[source]

Bases: _StrictModel

Configuration for Vercel queue (REST-based).

api_token: str
team_id: str | None
project_id: str | None
default_queue: str
model_config = {'extra': 'forbid'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class derp.config.ScheduleConfig[source]

Bases: _StrictModel

A single recurring task schedule.

name: str
task: str
cron: str | None
interval_seconds: float | None
payload: dict[str, Any] | None
queue: str | None
path: str | None
model_config = {'extra': 'forbid'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class derp.config.QueueConfig[source]

Bases: _StrictModel

Queue configuration.

celery: CeleryConfig | None
vercel: VercelQueueConfig | None
schedules: Sequence[ScheduleConfig]
model_config = {'extra': 'forbid'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class derp.config.ModalConfig[source]

Bases: _StrictModel

Configuration for Modal.

token_id: str
token_secret: str
endpoint_url: str | None
model_config = {'extra': 'forbid'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class derp.config.AIConfig[source]

Bases: _StrictModel

AI configuration for OpenAI-compatible providers.

api_key: str
base_url: str | None
fal_api_key: str | None
modal: ModalConfig | None
model_config = {'extra': 'forbid'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class derp.config.DerpConfig[source]

Bases: _StrictModel

Derp configuration.

database: DatabaseConfig
email: EmailConfig | None
storage: StorageConfig | None
auth: AuthConfig | None
kv: KVConfig | None
payments: PaymentsConfig | None
queue: QueueConfig | None
ai: AIConfig | None
classmethod load(path='derp.toml')[source]
Parameters:

path (str | Path)

Return type:

DerpConfig

redacted_dump()[source]

Return config as a dict with environment variable values redacted.

Return type:

dict

model_config = {'extra': 'forbid'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_post_init(context, /)

This function is meant to behave like a BaseModel method to initialize private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Parameters:
  • self (BaseModel) – The BaseModel instance.

  • context (Any) – The context.

Return type:

None

derp.config.create_default_config()[source]

Return default configuration file content.

Return type:

str