forked from unimatrix/web
Post audited service compensation through a shared rolling reserve
This commit is contained in:
parent
46685c5da0
commit
421b3a6ec0
1 changed files with 233 additions and 14 deletions
8
website/scripts/setup-service-compensation.mjs
Normal file
8
website/scripts/setup-service-compensation.mjs
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
import {fileURLToPath} from 'node:url';import {resolve} from 'node:path';import {openDatabase} from '../node/mysql.mjs';import {openPostbankDatabase} from '../node/postbank-db.mjs';import {canRunScheduler} from '../node/scheduler-authority.mjs';import {setupCompensationReserve} from '../node/postbank-standing-instructions.mjs';
|
||||
if(process.argv[1]&&fileURLToPath(import.meta.url)===resolve(process.argv[1])){
|
||||
const central=await openDatabase(process.env),bank=await openPostbankDatabase(process.env);
|
||||
try{
|
||||
const actorId=process.argv.find(a=>a.startsWith('--actor='))?.slice(8);if(!bank||!await canRunScheduler(central,{id:actorId}))throw Error('Current Big Four control or deployment service identity required.');
|
||||
console.log(JSON.stringify(await setupCompensationReserve(bank,{actorId,apply:process.argv.includes('--apply')})));
|
||||
}finally{await bank?.close();await central.close();}
|
||||
}
|
||||
Loading…
Reference in a new issue

Staff