20 lines
1.2 KiB
TypeScript
20 lines
1.2 KiB
TypeScript
import assert from "node:assert/strict"
|
|
process.env.AUTH_REQUIRED = "true"
|
|
process.env.AUTH_JWT_SECRET = "mcp-owned-native-conservation-acceptance-secret"
|
|
const { pool, closePool } = await import("../../db/index.js")
|
|
const { applySqlMigrations } = await import("../../db/migrate.js")
|
|
const { updateMcpSettings } = await import("./store.js")
|
|
const actor = { id: "native-conservation-acceptance-owner", apps: ["mm"], permissions: ["mm:settings:admin", "mm:network:admin"], expiresAt: Date.now() + 3600000 }
|
|
try {
|
|
await applySqlMigrations(pool)
|
|
assert.equal((await pool.query("SELECT count(*)::int AS n FROM servers")).rows[0].n, 0, "Disposable empty database required")
|
|
await updateMcpSettings({ enabled: true }, actor)
|
|
await (await import("./native-conservation-acceptance.js")).acceptNativeConservation(actor)
|
|
await (await import("./native-create-id-acceptance.js")).acceptNativeCreateId(actor)
|
|
} finally {
|
|
await pool.query("UPDATE servers SET enabled=false").catch(() => {})
|
|
await (await import("../../services/scheduler.js")).stopSchedulerForDatabaseOperation()
|
|
await (await import("../../services/traffic-flow-ingest.js")).stopTrafficFlowListenerForDatabaseOperation()
|
|
await closePool()
|
|
}
|