added adapter exports, generalized env-depending config construction

This commit is contained in:
dswbx
2025-01-25 11:54:19 +01:00
parent acc504cdc9
commit 9ddacb7ae5
11 changed files with 53 additions and 35 deletions

View File

@@ -2,7 +2,7 @@ import { createRuntimeApp } from "adapter";
import { App } from "bknd";
import type { CloudflareBkndConfig, Context } from "../index";
export async function getCached(config: CloudflareBkndConfig, { env, ctx }: Context) {
export async function getCached(config: CloudflareBkndConfig, { env, ctx, ...args }: Context) {
const { kv } = config.bindings?.(env)!;
if (!kv) throw new Error("kv namespace is not defined in cloudflare.bindings");
const key = config.key ?? "app";
@@ -37,7 +37,7 @@ export async function getCached(config: CloudflareBkndConfig, { env, ctx }: Cont
},
adminOptions: { html: config.html }
},
env
{ env, ctx, ...args }
);
if (!cachedConfig) {