25 lines
723 B
JavaScript
25 lines
723 B
JavaScript
import { getConfig } from "./common/config.js";
|
|
import { watchAudits } from "./common/queue.js";
|
|
import { getPool } from "./db/index.js";
|
|
|
|
export async function loadApps() {
|
|
const config = getConfig();
|
|
const client = await getPool();
|
|
for (const type in config.appModules) {
|
|
// Internal modules (e.g. dashboard) have no `app` row / API surface.
|
|
if (config.appModules[type]?.internal) continue;
|
|
await client.query(`
|
|
INSERT INTO public.app (
|
|
type
|
|
) VALUES (
|
|
$1
|
|
) ON CONFLICT DO NOTHING;
|
|
`, [
|
|
type,
|
|
]);
|
|
if (type === 'core')
|
|
watchAudits();
|
|
}
|
|
await client.release();
|
|
}
|