diff options
| author | Dennis Fink | 2026-11-17 21:06:05 +0100 |
|---|---|---|
| committer | Dennis Fink | 2026-11-17 21:06:05 +0100 |
| commit | c4c17e3e046a627a7d2353c734bc69f05d4fc3b1 (patch) | |
| tree | ebc343ce994c0c32243e1f8b7e654ee902d714bc /contrib/webmentions-ssg.example.cfg | |
| parent | 5e24e8307f650e72881f747661a2b6e52db15f2d (diff) | |
| download | webmentions-ssg-c4c17e3e046a627a7d2353c734bc69f05d4fc3b1.tar.gz webmentions-ssg-c4c17e3e046a627a7d2353c734bc69f05d4fc3b1.zip | |
feat(core): add configurable SQLite pragmas
Apply validated SQLite settings through SQLAlchemy's connection event so
every SQLite connection and bind receives consistent foreign key, WAL,
timeout, and security defaults.
Allow deployments to override supported PRAGMAs safely while skipping
file-only settings for in-memory databases and leaving other database
backends untouched.
Diffstat (limited to 'contrib/webmentions-ssg.example.cfg')
| -rw-r--r-- | contrib/webmentions-ssg.example.cfg | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/contrib/webmentions-ssg.example.cfg b/contrib/webmentions-ssg.example.cfg index 9be2cf0..6393b3f 100644 --- a/contrib/webmentions-ssg.example.cfg +++ b/contrib/webmentions-ssg.example.cfg @@ -40,6 +40,35 @@ PROXY_FIX_TRUSTED_HOPS = 0 SQLALCHEMY_DATABASE_URI = "sqlite:////var/lib/webmentions-ssg/webmentions-ssg.db" SQLALCHEMY_TRACK_MODIFICATIONS = False +# Optional SQLite-only tuning. Unspecified keys use the built-in defaults; +# setting a value to None leaves that SQLite PRAGMA unchanged. These settings +# apply to SQLAlchemy connections (including binds), not the separate Huey queue. +# They do not affect PostgreSQL or other SQLAlchemy database backends. +# +# Built-in defaults: foreign_keys=True, journal_mode="WAL", busy_timeout=5000 +# (milliseconds), trusted_schema=False. The remaining settings are None. +# +# WAL requires a file-backed database on a local filesystem. SQLite also needs +# directory write access for the -wal and -shm sidecar files. In-memory SQLite +# ignores journal_mode, wal_autocheckpoint, and journal_size_limit here. +# +# SQLITE_PRAGMAS = { +# "busy_timeout": 10000, # milliseconds waiting for a write lock +# "synchronous": "NORMAL", # faster WAL commits; reduced crash durability +# "cache_size": -8192, # approx. 8 MiB per connection (negative = KiB) +# "wal_autocheckpoint": 1000, # pages; SQLite's built-in default +# "journal_size_limit": 67108864, # bytes of retained journal/WAL storage +# "journal_mode": "WAL", # or "DELETE", "TRUNCATE", "PERSIST" +# "foreign_keys": True, # enforce foreign key constraints +# "trusted_schema": False, # disable untrusted schema functions +# } +# You may also set one key through the environment, for example: +# WEBMENTIONS_SSG_SQLITE_PRAGMAS__CACHE_SIZE=-8192 +# (environment values are parsed as JSON; lower/upper-case keys are accepted). +# Only known PRAGMAs and correctly typed values are accepted at startup. +# "synchronous" also accepts "FULL", "EXTRA" or "OFF" (unsafe); None leaves +# SQLite's choice alone. Optimizer PRAGMA optimize is NOT run at connect time. + # --------------------------------------------------------------------------- # Logging # --------------------------------------------------------------------------- |
