atproto/services/pds/run-script.js
Daniel Holmgren ca0ca08832
Rebuild repo script (#2528)
* wip

* first pass on script

* move scrip

* handle sequencing & account manager table

* runner

* fix while loop

* script framework

* build branch

* add prompt

* reorder script

* patch script

* move readline

* dont build branch

* tidy promise
2024-05-28 18:42:37 -05:00

27 lines
544 B
JavaScript

/* eslint-env node */
'use strict'
const {
envToCfg,
envToSecrets,
readEnv,
AppContext,
scripts,
} = require('@atproto/pds')
const main = async () => {
const env = readEnv()
const cfg = envToCfg(env)
const secrets = envToSecrets(env)
const ctx = await AppContext.fromConfig(cfg, secrets)
const scriptName = process.argv[2]
const script = scripts[scriptName ?? '']
if (!script) {
throw new Error(`could not find script: ${scriptName}`)
}
await script(ctx, process.argv.slice(3))
console.log('DONE')
}
main()