import type { Config } from "../config.js"; import type { Store } from "./store.js"; import { SqliteStore } from "./store.js"; import { PostgresStore } from "./postgres-store.js"; export async function createStore(config: Config): Promise { const backend = config.storeBackend === "postgres" || config.databaseUrl ? "postgres" : "sqlite"; if (backend === "postgres") { const store = new PostgresStore(config.databaseUrl); await store.init(); return store; } return new SqliteStore(config.sqlitePath); }