jfromaniello / winser

Run a node.js application as a window service using nssm.
270 stars 47 forks source link

Enviromental Variables #34

Open Rcjuk opened 10 years ago

Rcjuk commented 10 years ago

How can you set these? I can see the --env option but am struggling to get this to work.

Thanks

bjrmatos commented 9 years ago

I look at the source code of winser in node_modules.bin\winser and it seems that should be passed like this:

winser --env NODE_ENV=production --env DUMMY=1

but this fails with the error:

memo.push(val); ^ TypeError: Cannot call method 'push' of undefined at collect (C:\xampp\htdocs\windows-service-test\node_modules\winser\bin\winser:20:8)

bjrmatos commented 9 years ago

rigth now i'm doing this:

node_modules\\winser\\bin\\nssm set [nombre-de-app] AppEnvironmentExtra NODE_ENV=production

it works but it is a little ugly :(

davehibshman commented 8 years ago

I can't get the winser --set option to understand anything I pass to it either, similar to your --env problem described here. The 'arg' the error message spits out is always a single seemingly random character despite calling it as such: winser -i -s --set "servicename Application C:\\apth\\of\\some\\kind.exe" or winser -i -s --set "Application C:\\apth\\of\\some\\kind.exe" or winser -i -s --set "Application=C:\\apth\\of\\some\\kind.exe" or winser -i -s --set Application=C:\apth\of\some\kind.exe