mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-15 20:17:22 +00:00
fixed auth strategy toggle, updated astro/remix
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
import { readFile } from "node:fs/promises";
|
||||
import { serveStatic } from "@hono/node-server/serve-static";
|
||||
import { createClient } from "@libsql/client/node";
|
||||
import { App, registries } from "./src";
|
||||
import { LibsqlConnection } from "./src/data";
|
||||
import { StorageLocalAdapter } from "./src/media/storage/adapters/StorageLocalAdapter";
|
||||
|
||||
registries.media.register("local", StorageLocalAdapter);
|
||||
@@ -12,17 +10,15 @@ const example = import.meta.env.VITE_EXAMPLE;
|
||||
const credentials = example
|
||||
? {
|
||||
url: `file:.configs/${example}.db`
|
||||
//url: ":memory:"
|
||||
}
|
||||
: {
|
||||
url: import.meta.env.VITE_DB_URL!,
|
||||
authToken: import.meta.env.VITE_DB_TOKEN!
|
||||
};
|
||||
if (!credentials.url) {
|
||||
throw new Error("Missing VITE_DB_URL env variable. Add it to .env file");
|
||||
}
|
||||
|
||||
const connection = new LibsqlConnection(createClient(credentials));
|
||||
: import.meta.env.VITE_DB_URL
|
||||
? {
|
||||
url: import.meta.env.VITE_DB_URL!,
|
||||
authToken: import.meta.env.VITE_DB_TOKEN!
|
||||
}
|
||||
: {
|
||||
url: ":memory:"
|
||||
};
|
||||
|
||||
let initialConfig: any = undefined;
|
||||
if (example) {
|
||||
@@ -31,11 +27,17 @@ if (example) {
|
||||
}
|
||||
|
||||
let app: App;
|
||||
const recreate = true;
|
||||
const recreate = import.meta.env.VITE_APP_DISABLE_FRESH !== "1";
|
||||
export default {
|
||||
async fetch(request: Request) {
|
||||
if (!app || recreate) {
|
||||
app = App.create({ connection, initialConfig });
|
||||
app = App.create({
|
||||
connection: {
|
||||
type: "libsql",
|
||||
config: credentials
|
||||
},
|
||||
initialConfig
|
||||
});
|
||||
app.emgr.onEvent(
|
||||
App.Events.AppBuiltEvent,
|
||||
async () => {
|
||||
|
||||
Reference in New Issue
Block a user