Closed DuncanIdahoCT closed 1 year ago
The app reads the environment variables from the system no matter where they are sourced from, so I assume the dotenv package is populating those for you. In the docker example, docker is doing just that.
You just need to define the environment variables for the process within the Windows service execution (or, less preferred define system-wide). It really depends on your shell and platform used, I'm not sure how to do it in your scenario but I remember using .bat files and utilities for Windows services to do it in the old days. There's likely plenty of examples available if you search for "environment variables" and "windows service". Good luck!
This is not so much of an issue as a feature request. Perhaps it’s already there but I don’t know how to use it… in the installation under Node.js, it says to just define the environment vars and run but the code isn’t “looking” for a .env file nor any other file such as the onstar2mqtt.env that’s mentioned above. I’m sure it’s fine in Docker but I’m running it in Node as a windows service.
To make it work, I simply added the dotenv requirement to the top of index.js and added it to dependencies.
Index.js require('dotenv').config();
package.json "dotenv": "^16.0.3",
This works but I must do it each time I pull a new version from your main branch or find a fork that already has it but isn’t as up to date as yours… perhaps I’m just not defining the env vars correctly :) but I did notice the code is natively setup for .env / dotenv so I made that assumption and it works