triggerdotdev/trigger.dev

feat: Support custom run command so I can use dotenvx

Closed this issue · 4 comments

Is your feature request related to a problem? Please describe.

I manage environment vars with dotenvx. The way is works is that you store encrypted env vars in your repo, and you have just one secret key that gets used to unencrypt everything else at runtime. Makes env management across multiple platforms much easier.

The problem is that you unencrypt vars by using a custom run command, ex.:

dotenvx run -- my_script.ts

This doesn't work well with trigger.dev. Could you allow me to set custom run commands for my tasks?

Describe the solution you'd like to see

Allow a custom run command to be specified in the task config, or support doing this with extensions.

Describe alternate solutions

My temp solutions:

  • don't use dotenvx for the vars that I want to use with my trigger.dev tasks
  • Wrap my task script so that instead of calling directly, my task does something like run_bash('dotenvx run -- node my_script.js'). Haven't tested this yet; it would probably work but I assume it would cause me to lose my telemetry.

Additional information

No response

@warrenbhw I'm not familiar enough with trigger.dev but could you instead load dotenvx in code using the .config() method?

// somejob.js
require('@dotenvx/dotenvx').config()
console.log(`Hello ${process.env.HELLO}`)

Let me give this a shot! Thanks

hi @warrenbhw. i added trigger.dev to the dotenvx docs this morning

https://dotenvx.com/docs/background-jobs/triggerdotdev

image

@motdotla sry for delayed response. This is awesome! Thanks a bunch!!
I initially got my trigger.dev workflow running with the workaround of just maintaining copies of the env vars for use with trigger workflows, but I'm stoked that I can clean it up and just use dotenvx for everything