mirror of
https://github.com/Elysola/WebHooker.git
synced 2026-11-21 01:23:40 +00:00
fix(config): transact per-group configuration
Whole-table writes and cached snapshots can overwrite other groups or resurrect removed configuration. Use per-group guarded writes, one-time identity migration and explicit unreadable-row failures.
This commit is contained in:
1 parent
ceb906d479
commit
c853f2910f
7 files changed
+1764
-587
No files matched your search
@@ -0,0 +1,13 @@
|
||||
import type { Env } from "../lib/types";
|
||||
import { initConfigStore } from "../lib/config";
|
||||
|
||||
/**
|
||||
* Bind the D1-backed configuration store before any handler runs, so no
|
||||
* request path (invite acceptance, OAuth callbacks, bot commands, ...) can
|
||||
* fall back to the KV-only store and read or write a configuration that
|
||||
* diverges from D1.
|
||||
*/
|
||||
export default defineEventHandler((event) => {
|
||||
const env = (event.context.cloudflare as { env?: Env } | undefined)?.env;
|
||||
if (env?.KV) initConfigStore(env);
|
||||
});
|
||||
Reference in new issue
Block a user