Init
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
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();
|
||||
})();
|
||||
Reference in New Issue
Block a user