Domanda

I'm having a problem with a NPM post-install script, the issue is that the build process ignores the configured NODE_ENV (set via cctrlapp x/y config.add) and always defaults to production. For what I've seen this was "resolved" two months ago by Heroku. From this issue, it seems that it should be transparent.

Is there something I must do to have access to my ENV variables during the build? Any workaround?

Thanks!

È stato utile?

Soluzione

I found a workaround, from the different ENV vars the only one with a value during the build is DEP_NAME, but it's enough since we can extract the env from it: project/environment. This works in CloudControl, no idea if it would work in Heroku.

if ('DEP_NAME' in process.env) {
    process.env.NODE_ENV = process.env.DEP_NAME.split('/')[1];
}
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top