Simulating secrets locally

I'm running an Autotask locally, following the examples, and it's working great. However when I tried to utilize the secrets feature, it wasn't clear how to simulate it locally. Is there an example somewhere? I assume there's a way to pull it from my local .env, but I can't figure it out. Thanks!

Hey @ptrwtts! Secrets just get injected into the Autotask event payload, so it depends on how you're invoking your Autotask locally. For instance, in this example, all you would have to do is:

// Entrypoint for the Autotask
exports.handler = async function(event) {
  const relayer = new Relayer(event);
  const { secrets } = event;
  return exports.main(relayer, secrets);  
}

// To run locally (this code will not be executed in Autotasks)
if (require.main === module) {
  require('dotenv').config();
  const { API_KEY: apiKey, API_SECRET: apiSecret } = process.env;
  const secrets = JSON.parse(process.env.SECRETS); // Example for loading a secrets JSON from an env var
  exports.handler({ apiKey, apiSecret, secrets })
    .then(() => process.exit(0))
    .catch(error => { console.error(error); process.exit(1); });
}