Files
jerapah-flow/packages/server/knexfile.js
T
nsrb 023cf83cfa feat: enhance project structure with server and workflow management
- Introduced a new server package with Fastify for handling API requests and workflows.
- Implemented user authentication and authorization with JWT and cookie management.
- Added endpoints for managing workflows, runs, and user accounts.
- Established a dashboard for monitoring workflow status and statistics.
- Included a script sandbox for executing user-defined scripts securely.
- Updated README with setup instructions and API documentation.
- Configured database migrations for user management.
- Enhanced logging capabilities for better traceability.
2026-08-14 14:25:37 +07:00

35 lines
821 B
JavaScript

import fs from "fs";
import path from "path";
import { DATA_DIR, SERVER_ROOT } from "./paths.js";
const dbPath = process.env.SCRUNNER_DB_PATH ?? path.join(DATA_DIR, "scrunner.db");
fs.mkdirSync(path.dirname(dbPath), { recursive: true });
/** @type {import("knex").Knex.Config} */
const config = {
client: "better-sqlite3",
connection: {
filename: dbPath,
},
useNullAsDefault: true,
migrations: {
directory: path.join(SERVER_ROOT, "migrations"),
extension: "js",
loadExtensions: [".js"],
},
pool: {
afterCreate(conn, done) {
try {
conn.pragma("journal_mode = WAL");
conn.pragma("busy_timeout = 5000");
conn.pragma("foreign_keys = ON");
done(null, conn);
} catch (err) {
done(err, conn);
}
},
},
};
export default config;