Files
jerapah-flow/packages/server/knexfile.js
nsrb 56a5d0e7d2 refactor: rename environment variables and update related configurations
- Updated environment variable names from JERAPAH_FLOW_* to JFLOW_* for consistency and clarity.
- Adjusted database path handling in knexfile.js to reflect the new variable naming.
- Modified logging and retention days configurations to use the new variable names.
- Ensured that the JWT secret and secrets key checks are aligned with the new naming convention.
- Updated workflow test storage prefix to match the new project branding.

This refactor enhances the clarity of environment variable usage and aligns with the project's rebranding efforts.
2026-08-16 22:44:19 +07:00

36 lines
824 B
JavaScript

import fs from "fs";
import path from "path";
import { DATA_DIR, SERVER_ROOT } from "./paths.js";
const dbPath =
process.env.JFLOW_DB_PATH ?? path.join(DATA_DIR, "jerapah-flow.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;