selfhostable, read-only reddit client

allow path to db as arg

Changed files
+10 -10
scripts
+10 -10
scripts/gen-invite.js
··· 1 1 import { Database } from "bun:sqlite"; 2 2 3 - const db = new Database("readit.db", { 3 + const command = process.argv[2]; 4 + 5 + const dbPath = process.argv[3] ? process.argv[3] : "readit.db"; 6 + const db = new Database(dbPath, { 4 7 strict: true, 5 8 }); 9 + 10 + if (command === "create") { 11 + createInvite(); 12 + } else { 13 + console.log("requires an arg"); 14 + } 6 15 7 16 db.run(` 8 17 CREATE TABLE IF NOT EXISTS invites ( ··· 23 32 db.run("INSERT INTO invites (token) VALUES ($token)", { token }); 24 33 console.log(`Invite token created: ${token}`); 25 34 } 26 - 27 - const command = process.argv[2]; 28 - const arg = process.argv[3]; 29 - 30 - if (command === "create") { 31 - createInvite(); 32 - } else { 33 - console.log("requires an arg"); 34 - }