Classes
AppConfig
80
▼
Application configuration. Immutable after creation.
All fields have sensible defaults. Override w…
AppConfig
80
▼
Application configuration. Immutable after creation.
All fields have sensible defaults. Override what you need::
config = AppConfig(debug=True, port=3000, secret_key="s3cr3t")
Attributes
| Name | Type | Description |
|---|---|---|
host |
str
|
— |
port |
int
|
— |
debug |
bool
|
— |
reload_include |
tuple[str, ...]
|
— |
reload_dirs |
tuple[str, ...]
|
— |
dev_browser_reload |
bool
|
— |
secret_key |
str
|
— |
allowed_hosts |
tuple[str, ...]
|
— |
csp_nonce_enabled |
bool
|
— |
strict_transport_security |
str | None
|
— |
template_dir |
str | Path
|
— |
component_dirs |
tuple[str | Path, ...]
|
— |
extra_loaders |
tuple[Any, ...]
|
— |
autoescape |
bool
|
— |
trim_blocks |
bool
|
— |
lstrip_blocks |
bool
|
— |
static_dir |
str | Path | None
|
— |
static_url |
str
|
— |
sse_heartbeat_interval |
float
|
— |
sse_retry_ms |
int | None
|
— |
sse_close_event |
str | None
|
— |
mcp_path |
str
|
— |
safe_target |
bool
|
— |
sse_lifecycle |
bool
|
— |
view_transitions |
bool | str
|
— |
speculation_rules |
bool | str
|
— |
delegation |
bool
|
— |
alpine |
bool
|
— |
alpine_version |
str
|
— |
alpine_csp |
bool
|
— |
islands |
bool
|
— |
islands_version |
str
|
— |
islands_contract_strict |
bool
|
— |
max_content_length |
int
|
— |
workers |
int
|
— |
worker_mode |
str
|
— |
metrics_enabled |
bool
|
— |
metrics_path |
str
|
— |
rate_limit_enabled |
bool
|
— |
rate_limit_requests_per_second |
float
|
— |
rate_limit_burst |
int
|
— |
request_queue_enabled |
bool
|
— |
request_queue_max_depth |
int
|
— |
sentry_dsn |
str | None
|
— |
sentry_environment |
str | None
|
— |
sentry_release |
str | None
|
— |
sentry_traces_sample_rate |
float
|
— |
reload_timeout |
float
|
— |
otel_endpoint |
str | None
|
— |
otel_service_name |
str
|
— |
websocket_compression |
bool
|
— |
websocket_max_message_size |
int
|
— |
lifecycle_logging |
bool
|
— |
log_format |
str
|
— |
log_level |
str
|
— |
max_connections |
int
|
— |
backlog |
int
|
— |
keep_alive_timeout |
float
|
— |
request_timeout |
float
|
— |
ssl_certfile |
str | None
|
— |
ssl_keyfile |
str | None
|
— |
cache_backend |
str
|
— |
cache_default_ttl |
int
|
— |
cache_middleware_enabled |
bool
|
— |
i18n_enabled |
bool
|
— |
i18n_default_locale |
str
|
— |
i18n_supported_locales |
tuple[str, ...]
|
— |
i18n_directory |
str | Path
|
— |
i18n_cookie_name |
str
|
— |
i18n_url_prefix |
bool
|
— |
env |
str
|
— |
redis_url |
str | None
|
— |
audit_sink |
str | None
|
— |
feature_flags |
tuple[tuple[str, bool], ...]
|
— |
http_timeout |
float
|
— |
http_retries |
int
|
— |
skip_contract_checks |
bool
|
— |
lazy_pages |
bool
|
— |
Methods
from_env
1
AppConfig
▼
Load configuration from environment variables.
Reads env vars with the given p…
classmethod
from_env
1
AppConfig
▼
def from_env(cls, prefix: str = 'CHIRP_') -> AppConfig
Load configuration from environment variables.
Reads env vars with the given prefix (defaultCHIRP_).
Unset vars use AppConfig defaults.
Ifpython-dotenv is installed (pip install chirp[config]),
loads.envfrom the current directory before reading env.
Env vars (with CHIRP_ prefix):
SECRET_KEY, DEBUG, ENV, HOST, PORT,
LOG_FORMAT (auto|text|json — forwarded to Pounce),
SENTRY_DSN, SENTRY_ENVIRONMENT, SENTRY_RELEASE,
REDIS_URL, AUDIT_SINK, SKIP_CONTRACT_CHECKS, LAZY_PAGES,
HTTP_TIMEOUT, HTTP_RETRIES,
FEATURE_
Parameters
| Name | Type | Description |
|---|---|---|
prefix |
— |
Default:'CHIRP_'
|
Returns
AppConfig
feature
1
bool
▼
Return True if the named feature flag is enabled.
feature
1
bool
▼
def feature(self, name: str) -> bool
Parameters
| Name | Type | Description |
|---|---|---|
name |
— |
Returns
bool
Functions
_env_log_format
2
str
▼
Read log format from env; invalid values fall back to default.
_env_log_format
2
str
▼
def _env_log_format(key: str, default: str) -> str
Parameters
| Name | Type | Description |
|---|---|---|
key |
str |
|
default |
str |
Returns
str