#Reading config file from nodejs sidecar

6 messages · Page 1 of 1 (latest)

chrome monolith
#

I have a nodejs binary packaged using pkg. It reads config file default.json. I can see I can run the binary as a sidecar but don't know how I can include the config file. Is there a solution?

wooden pendant
#

You could then pass the location of the config file to the Node.js binary as an arg when starting it as a sidecar.

chrome monolith
#

Hmm, thanks for the idea. I will give it a shot.

chrome monolith
#

So my nodejs app uses https://www.npmjs.com/package/config for config management. I see in the docs I can set a NODE_CONFIG_DIR environment variable to specify the location. Is it possible to set an environment variable in Tauri prior to running the binary in a sidecar?

wooden pendant
#

Yes, you can use .env("key", "value") for that.