28 lines
828 B
JavaScript
28 lines
828 B
JavaScript
import express from "express";
|
|
import { init, close, migrate, populateAgreements } from "./db/index.js";
|
|
import { loadConfig } from "./common/config.js";
|
|
import { loadApps } from "./apps.js";
|
|
import { initHTTP } from "./http/index.js";
|
|
import { migrateLegacyApiKeys } from "./modules/core/apiKey.js";
|
|
|
|
const app = express();
|
|
app.set("env", "development");
|
|
app.use(express.static("./public"));
|
|
|
|
async function main() {
|
|
await loadConfig();
|
|
await init();
|
|
await migrate();
|
|
await populateAgreements();
|
|
await loadApps();
|
|
await initHTTP(app);
|
|
// After initHTTP so the auth rows (incl. the single/Docker user's) exist.
|
|
await migrateLegacyApiKeys();
|
|
const server = await app.listen(9090, () => {
|
|
console.log(`Listening on 0.0.0.0:9090`);
|
|
});
|
|
server.on("beforeExit", close);
|
|
}
|
|
|
|
main();
|