22 lines
1.1 KiB
TypeScript
22 lines
1.1 KiB
TypeScript
/** Server process for e2e/load.ts: same startServer as production, seeded with playable songs. */
|
|
import { join } from 'node:path';
|
|
import { loadConfig } from '../apps/server/src/config';
|
|
import { startServer } from '../apps/server/src/server';
|
|
import { Catalog } from '../apps/server/src/collector/catalog';
|
|
|
|
const app = startServer({
|
|
config: loadConfig({ PORT: process.env.PORT!, DB_PATH: process.env.DB_PATH!, PUBLIC_ORIGIN: process.env.PUBLIC_ORIGIN!, TRUST_PROXY: '1' }),
|
|
log: () => {},
|
|
staticDir: null,
|
|
gameTiming: { countdownMs: 1000, revealMs: 1500 },
|
|
});
|
|
const c = new Catalog(app.db);
|
|
for (let i = 1; i <= 20; i++) {
|
|
const [id] = c.upsert({ title: `부하곡${i}`, artists: [{ name: `부하가수${i}` }], year: 2000 + i, genres: ['kpop'], source: 'load', ref: String(i) });
|
|
c.autoLevel(id!, 'all', 3);
|
|
app.db.query("UPDATE songs SET youtube_status = 'matched', embeddable = 1, youtube_id = ?, duration_sec = 200 WHERE id = ?").run(`load${String(i).padStart(7, '0')}`, id!);
|
|
}
|
|
setInterval(() => process.send?.({ rss: process.memoryUsage().rss }), 1000);
|
|
console.log('ready');
|
|
void join;
|