forked from
rocksky.app/rocksky
A decentralized music tracking and discovery platform built on AT Protocol 馃幍
1import chalk from "chalk";
2import { ctx } from "context";
3import { encrypt } from "lib/crypto";
4import { env } from "lib/env";
5import tables from "schema";
6
7const args = process.argv.slice(2);
8const clientId = args[0];
9const clientSecret = args[1];
10
11if (!clientId || !clientSecret) {
12 console.error(
13 "Please provide Spotify Client ID and Client Secret as command line arguments",
14 );
15 console.log(
16 chalk.greenBright("Usage: ts-node spotify.ts <client_id> <client_secret>"),
17 );
18 process.exit(1);
19}
20
21await ctx.db
22 .insert(tables.spotifyApps)
23 .values([
24 {
25 spotifyAppId: clientId,
26 spotifySecret: encrypt(clientSecret, env.SPOTIFY_ENCRYPTION_KEY),
27 },
28 ])
29 .onConflictDoNothing()
30 .execute();
31
32process.exit(0);