diff --git a/package.json b/package.json index e5cb862..97f57a1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "forever-service", - "version": "0.4.4", + "version": "0.4.5", "preferGlobal": "true", "description": "Provision node script as a service via forever, allowing it to automatically start on boot, working across various Linux distros and OS", "main": "lib/api.js", diff --git a/templates/sysvinit/initd.template b/templates/sysvinit/initd.template index 04d2975..2ab2d63 100644 --- a/templates/sysvinit/initd.template +++ b/templates/sysvinit/initd.template @@ -23,6 +23,13 @@ # CLI {{cli}} # Working Directory {{cwd}} +#Setup Environment variables (if any) +{%- if envVarsArray|default(false) %} +{%- for v in envVarsArray %} +export {{ v }} +{%- endfor %} +{%- endif %} + # Check if any of $pid (could be plural) are running PIDFILE="/var/run/{{service}}.pid" LOGFILE="/var/log/{{service}}.log" @@ -88,7 +95,6 @@ start() { ulimit -u 32000 {% endif %} - {{envVars|default('')}} \ {{foreverPath}}forever \ --pidFile $PIDFILE \ -a \