feat: real entrypoint using loadConfig
This commit is contained in:
@@ -1,15 +1,8 @@
|
|||||||
import { buildApp } from './app.js'
|
import { buildApp } from './app.js'
|
||||||
import { openDatabase } from './db.js'
|
import { openDatabase } from './db.js'
|
||||||
import type { Config } from './config.js'
|
import { loadConfig } from './config.js'
|
||||||
|
|
||||||
const config: Config = {
|
|
||||||
dataDir: process.env.DATA_DIR ?? 'data',
|
|
||||||
artworkDir: (process.env.DATA_DIR ?? 'data') + '/artwork-cache',
|
|
||||||
dbPath: (process.env.DATA_DIR ?? 'data') + '/record-shop.db',
|
|
||||||
port: Number(process.env.PORT ?? 3000),
|
|
||||||
sessionSecret: 'placeholder-replaced-in-task-3',
|
|
||||||
}
|
|
||||||
|
|
||||||
|
const config = loadConfig()
|
||||||
const db = openDatabase(config.dbPath)
|
const db = openDatabase(config.dbPath)
|
||||||
const app = await buildApp({ db, config })
|
const app = await buildApp({ db, config })
|
||||||
await app.listen({ port: config.port, host: '0.0.0.0' })
|
await app.listen({ port: config.port, host: '0.0.0.0' })
|
||||||
|
|||||||
Reference in New Issue
Block a user