Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const runScript = async (script, domain, globalCtx) => {
const doctypes = script.getDoctypes()
const token =
process.env.BATCH_TOKEN || (await admin.createToken(domain, doctypes))
const protocol = domain === 'cozy.tools:8080' ? 'http' : 'https'
const ach = new ACH(token, protocol + '://' + domain, doctypes)
await ach.connect()
const client = CozyClient.fromOldClient(ach.client)
const logger = namespacedLogger(domain)
return script.run({
...globalCtx,
client,
logger
})
}