Files
forge/server/mint-token.ts
T

20 lines
675 B
TypeScript
Raw Normal View History

2026-08-29 11:59:28 +03:00
import 'dotenv/config';
import { pool, initDB } from './db';
import { createToken } from './tokens';
// CLI: mint a sync token for the Chrome extension without going through the
// HTTP endpoint. Usage: npx tsx server/mint-token.ts "my laptop"
(async () => {
if (!process.env.DATABASE_URL) {
console.error('DATABASE_URL is required');
process.exit(1);
}
const label = process.argv.slice(2).join(' ') || 'sync-extension';
await initDB();
const raw = await createToken(label);
console.log('\nSync token (shown once — paste it into the extension options):\n');
console.log(' ' + raw + '\n');
console.log(`label: ${label}`);
await pool.end();
})();