I am struggling to find an example of using this package in a Node script that is run by a cron job. All of the examples I have found rely on __dirname (see here), which is not available when running a script as a module with the import syntax.
Running from cron seems like a core use case for Node scripts. Can anyone provide a working example of how to configure this so that Node scripts work regardless of the calling context? Or is this a problem that should be solved upstream somehow?
in the future consider dotenvx for this kind of thing. you might find it easier to install and get using. it's designed to run anywhere. it can wrap any script or command like this:
I am struggling to find an example of using this package in a Node script that is run by a cron job. All of the examples I have found rely on
__dirname
(see here), which is not available when running a script as a module with the import syntax.Running from cron seems like a core use case for Node scripts. Can anyone provide a working example of how to configure this so that Node scripts work regardless of the calling context? Or is this a problem that should be solved upstream somehow?