I have a /ect/init/application.conf
file that looks something like...
start on filesystem and net-device-up IFACE!=lo
stop on runlevel [016]
respawn
export NODE_ENV=production
chdir /home/richie/application
exec /home/richie/.nvm/v0.10.26/bin/node server/app >> /var/log/node.log 2>&1
It is meant to run a Node.js
application in production mode. However, when I run the application as a service:
sudo service application start
It outputs this data in the log when I output my environment variables:
{ UPSTART_INSTANCE: '',
UPSTART_JOB: 'application',
TERM: 'linux',
PATH: '/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin',
PWD: '/home/richie/application' }
As you can see, NODE_ENV
does not exist in the list of environment variables. Any idea why my exported environment variable would be ignored? I also have added into my /etc/environment
file:
NODE_ENV=production
Thanks in advance!
env NODE_ENV=production
instead ofexport NODE_ENV=production