Give a plugin a Postgres database of its own #78

Merged
lilleman merged 8 commits from plugin-storage into main 2026-08-20 21:52:15 +02:00
Owner

A plugin sets storage: true and gets a Postgres database and login role of its own, both named plugin_<id>, with the credentials handed to onBoot.

The host hands over credentials, not a client — a plugin depends on whichever driver it likes, so no driver shape enters the contract. Passwords are derived (HMAC-SHA256(PLUGIN_DB_SECRET, id)) rather than stored, keeping the host free of state. Only bootstrap gets the superuser DSN, since plugin code runs inside web and can read that process' environment.

HOST_API_VERSION stays at 1.0.0 per the recorded freeze — the change is additive and a zero-argument onBoot remains valid.

A plugin sets `storage: true` and gets a Postgres database and login role of its own, both named `plugin_<id>`, with the credentials handed to `onBoot`. The host hands over credentials, not a client — a plugin depends on whichever driver it likes, so no driver shape enters the contract. Passwords are derived (`HMAC-SHA256(PLUGIN_DB_SECRET, id)`) rather than stored, keeping the host free of state. Only `bootstrap` gets the superuser DSN, since plugin code runs inside `web` and can read that process' environment. `HOST_API_VERSION` stays at 1.0.0 per the recorded freeze — the change is additive and a zero-argument `onBoot` remains valid.
lilleman added 1 commit 2026-08-18 23:12:22 +02:00
Give a plugin a Postgres database of its own
CI / full-gate (push) Successful in 2m58s
bf638dfb19
lilleman added 1 commit 2026-08-18 23:24:39 +02:00
lilleman marked the pull request as work in progress 2026-08-18 23:24:58 +02:00
lilleman added 1 commit 2026-08-19 00:08:40 +02:00
lilleman added 1 commit 2026-08-19 00:20:22 +02:00
lilleman added 1 commit 2026-08-19 00:44:55 +02:00
lilleman added 1 commit 2026-08-19 01:03:45 +02:00
lilleman marked the pull request as ready for review 2026-08-19 01:07:04 +02:00
lilleman added 1 commit 2026-08-19 20:34:39 +02:00
# Conflicts:
#	package-lock.json
#	package.json
lilleman added 1 commit 2026-08-20 21:47:27 +02:00
Merge remote-tracking branch 'origin/main' into plugin-storage
CI / full-gate (push) Successful in 3m11s
Mirror / github-mirror (push) Successful in 6s
4f791d8f11
# Conflicts:
#	package-lock.json
#	package.json
lilleman merged commit 4f791d8f11 into main 2026-08-20 21:52:15 +02:00
lilleman deleted branch plugin-storage 2026-08-20 21:52:15 +02:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: larvit/plainpages#78