Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Support custom run command so I can use dotenvx #1466

Open
warrenbhw opened this issue Nov 12, 2024 · 3 comments
Open

feat: Support custom run command so I can use dotenvx #1466

warrenbhw opened this issue Nov 12, 2024 · 3 comments

Comments

@warrenbhw
Copy link

warrenbhw commented Nov 12, 2024

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

@motdotla
Copy link

@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}`)

@warrenbhw
Copy link
Author

Let me give this a shot! Thanks

@motdotla
Copy link

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

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

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants