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 /webmentions_ssg/__init__.py | |
| 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 '')
| -rw-r--r-- | webmentions_ssg/__init__.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/webmentions_ssg/__init__.py b/webmentions_ssg/__init__.py index 853045d..174250e 100644 --- a/webmentions_ssg/__init__.py +++ b/webmentions_ssg/__init__.py @@ -60,6 +60,11 @@ def create_app(config_class: type[DefaultConfig] | None = None) -> Flask: ) app.config.from_object(config_class) + # Flask's nested prefixed environment overrides mutate existing dicts. + # Avoid modifying the class-level defaults or another app's configuration. + if isinstance(app.config.get("SQLITE_PRAGMAS"), dict): + app.config["SQLITE_PRAGMAS"] = app.config["SQLITE_PRAGMAS"].copy() + if not app.testing: # Local development may omit its config file; production must not. app.config.from_pyfile(app.config["CONFIG_FILE"], silent=app.debug) |
