Strengthen financial reconciliation checks
This commit is contained in:
@@ -6,11 +6,12 @@ import { migrateCustody, grantCustodyRuntime } from '../server/market/postgres-s
|
||||
import { importSqliteCustody } from '../server/market/custody-import.ts';
|
||||
import { PostgresCustody } from '../server/market/postgres-custody.ts';
|
||||
import { IS_MAINNET } from '../shared/network.ts';
|
||||
import { resolveCustodyIncident } from '../server/market/custody-incident.ts';
|
||||
|
||||
// Explicit operator task, never invoked by node startup. No passwords or database URLs printed.
|
||||
if (IS_MAINNET) throw new Error('Only sandbox financial schema operations are implemented');
|
||||
const [action, argument] = process.argv.slice(2);
|
||||
if (!['migrate', 'grant-runtime', 'import-sqlite', 'audit'].includes(action)) throw new Error('Expected migrate, grant-runtime ROLE, import-sqlite DATA_DIR, or audit');
|
||||
if (!['migrate', 'grant-runtime', 'import-sqlite', 'audit', 'resolve-integrity'].includes(action)) throw new Error('Expected migrate, grant-runtime ROLE, import-sqlite DATA_DIR, audit, or resolve-integrity EVIDENCE_UUID');
|
||||
try {
|
||||
const config = await postgresConfig();
|
||||
if (action === 'audit') {
|
||||
@@ -21,6 +22,7 @@ try {
|
||||
try {
|
||||
if (action === 'migrate') { await migrateCustody(pool); console.log('Custody PostgreSQL schema verified/migrated. No funds activated.'); }
|
||||
if (action === 'grant-runtime') { await grantCustodyRuntime(pool, argument ?? ''); console.log('Runtime grants applied; no credentials printed.'); }
|
||||
if (action === 'resolve-integrity') console.log(JSON.stringify(await resolveCustodyIncident(pool, argument ?? '')));
|
||||
if (action === 'import-sqlite') {
|
||||
if (!argument) throw new Error('Stopped source node DATA_DIR required');
|
||||
const directory = resolve(argument);
|
||||
|
||||
Reference in New Issue
Block a user