{"action":"created","issue":{"url":"https://api.github.com/repos/Unitech/pm2/issues/1743","repository_url":"https://api.github.com/repos/Unitech/pm2","labels_url":"https://api.github.com/repos/Unitech/pm2/issues/1743/labels{/name}","comments_url":"https://api.github.com/repos/Unitech/pm2/issues/1743/comments","events_url":"https://api.github.com/repos/Unitech/pm2/issues/1743/events","html_url":"https://github.com/Unitech/pm2/issues/1743","id":114923052,"number":1743,"title":"Reloading WITH a new environment","user":{"login":"ZerbitX","id":100507,"avatar_url":"https://avatars.githubusercontent.com/u/100507?v=3","gravatar_id":"","url":"https://api.github.com/users/ZerbitX","html_url":"https://github.com/ZerbitX","followers_url":"https://api.github.com/users/ZerbitX/followers","following_url":"https://api.github.com/users/ZerbitX/following{/other_user}","gists_url":"https://api.github.com/users/ZerbitX/gists{/gist_id}","starred_url":"https://api.github.com/users/ZerbitX/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ZerbitX/subscriptions","organizations_url":"https://api.github.com/users/ZerbitX/orgs","repos_url":"https://api.github.com/users/ZerbitX/repos","events_url":"https://api.github.com/users/ZerbitX/events{/privacy}","received_events_url":"https://api.github.com/users/ZerbitX/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-11-03T22:16:32Z","updated_at":"2016-03-11T15:23:35Z","closed_at":"2016-03-11T15:23:35Z","body":"Apologies if this is in the documentation and I missed it...\r\n\r\nIs there a way with pmx to, fristly force a reload FROM the app, and secondly to do so with a new set of environment variables? Basically, something like...\r\n\r\n    var _ = require('lodash');\r\n    pmx.reload('appName', _.extend(process.env, someOverrideStuff));\r\n\r\nto effectively be akin to \r\n\r\n    var _ = require('lodash');\r\n    \r\n    // When a worker is killed, restart with a new environment    \r\n    cluster.on('exit', function(worker) {\r\n        if (worker.suicide === true) {\r\n            cluster.fork(process.env); \r\n        }\r\n    });\r\n    \r\n    // ... sometime later\r\n    _.extend(process.env, someOverrideStuff);\r\n    cluster.worker.kill();\r\n    \r\nIn general something like the example...\r\n    \r\n    pmx.action('debug:on', function(reply) {\r\n        DEBUG='*';\r\n        reply({DEBUG:DEBUG});\r\n    });\r\n    \r\n...would work fine, but I'm interested in changing the middleware stack of an app, and to avoid mucking with koa or express internals, that requires the app to be restarted and the app to call \"use\" on the middleware pieces in order. "},"comment":{"url":"https://api.github.com/repos/Unitech/pm2/issues/comments/195412199","html_url":"https://github.com/Unitech/pm2/issues/1743#issuecomment-195412199","issue_url":"https://api.github.com/repos/Unitech/pm2/issues/1743","id":195412199,"user":{"login":"Unitech","id":757747,"avatar_url":"https://avatars.githubusercontent.com/u/757747?v=3","gravatar_id":"","url":"https://api.github.com/users/Unitech","html_url":"https://github.com/Unitech","followers_url":"https://api.github.com/users/Unitech/followers","following_url":"https://api.github.com/users/Unitech/following{/other_user}","gists_url":"https://api.github.com/users/Unitech/gists{/gist_id}","starred_url":"https://api.github.com/users/Unitech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Unitech/subscriptions","organizations_url":"https://api.github.com/users/Unitech/orgs","repos_url":"https://api.github.com/users/Unitech/repos","events_url":"https://api.github.com/users/Unitech/events{/privacy}","received_events_url":"https://api.github.com/users/Unitech/received_events","type":"User","site_admin":false},"created_at":"2016-03-11T15:23:35Z","updated_at":"2016-03-11T15:23:35Z","body":"landing in next release (1.0.3)"}}