heroku-buildpack-nodejs
heroku-buildpack-nodejs copied to clipboard
Set WEB_CONCURRENCY_SET_BY if appropriate
If WEB_CONCURRENCY is unset and we are calculating it, or if it is set to an out-of-bounds value, then we set WEB_CONCURRENCY_SET_BY=heroku/nodejs.
The purpose of this variable is to allow another buildpack running before this buildpack, but which is actually the buildpack that's launching the web process, to be able to ignore the set value, or at least warn the user about the potentially wrong value for their purpose.
Without this, it's not possible for following code (e.g. the WEB_CONCURRENCY calculation of another language if it happens at startup) to tell the whether WEB_CONCURRENCY was set by the user, or whether it was set by e.g. heroku/nodejs - the variable exists in the environment in either case.
It's not uncommon for users of other programming languages to use heroku/nodejs together with their language, and have it e.g. build assets with webpack. The correct usage order in that case of course is to have heroku/nodejs install webpack first, then have the "main" programming language buildpack run, and from in there, using whatever hooks it provides, run e.g. 'webpack' - but many users instead set their "primary" language buildpack set as the first buildpack, and heroku/nodejs second (and have that run e.g. 'webpack' for them).
With this env var set, it's also possible for a user (or support) to understand where a value for WEB_CONCURRENCY is coming from.
Apologies for the confusing description; I've improved the commit message.
Wish I could turn this back into a draft PR...
Wish I could turn this back into a draft PR...
https://github.blog/changelog/2020-04-08-convert-pull-request-to-draft/